mil.dod.th.ose.remote/src/mil/dod/th/ose/remote/osgi/EventAdminMessageService.java
private synchronized void updateRegistration(final int regId)
    {
        final Collection<PersistentData> regCollection = m_Datastore.query(getClass(), String.valueOf(regId));
        if (!regCollection.isEmpty())
        {
            final PersistentData data = regCollection.iterator().next();

            // get existing message to update
            final byte[] bytes = (byte[])data.getEntity();
            final PersistentEventRegistrationMessage oldMessage;
            try
            {
                oldMessage = PersistentEventRegistrationMessage.parseFrom(bytes);
            }
            catch (final IOException e)
            {
                m_Logging.error(e, "Unable to update a remote event registration with ID %s from the datastore.", 
                        data.getDescription());
                // skip
                return;
            }

            final PersistentEventRegistrationMessage updatedMessage = PersistentEventRegistrationMessage.newBuilder(
                    oldMessage).setRemainingExpirationTimeHours(
                            (int)m_Registrations.getRemainingTime(regId, TimeUnit.HOURS)).build();
            data.setEntity(updatedMessage.toByteArray());
            try
            {
                m_Datastore.merge(data);
            }
            catch (final Exception e)
            {
                m_Logging.error(e, "Error persisting remote registration update");
            }
        }
    }
/**
     * Update the remaining expiration time for a remote event registration.
     * 
     * @param regId
     *      Registration ID
     */
Update the remaining expiration time for a remote event registration.

@param regId
Registration ID
Update the remaining expiration time for a remote event registration . @param regId Registration ID
private synchronized void updateRegistration(final int regId)
    {
        final Collection<PersistentData> regCollection = m_Datastore.query(getClass(), String.valueOf(regId));
        if (!regCollection.isEmpty())
        {
            final PersistentData data = regCollection.iterator().next();
            final byte[] bytes = (byte[])data.getEntity();
            final PersistentEventRegistrationMessage oldMessage;
            try
            {
                oldMessage = PersistentEventRegistrationMessage.parseFrom(bytes);
            }
            catch (final IOException e)
            {
                m_Logging.error(e, "Unable to update a remote event registration with ID %s from the datastore.", 
                        data.getDescription());
                return;
            }
            final PersistentEventRegistrationMessage updatedMessage = PersistentEventRegistrationMessage.newBuilder(
                    oldMessage).setRemainingExpirationTimeHours(
                            (int)m_Registrations.getRemainingTime(regId, TimeUnit.HOURS)).build();
            data.setEntity(updatedMessage.toByteArray());
            try
            {
                m_Datastore.merge(data);
            }
            catch (final Exception e)
            {
                m_Logging.error(e, "Error persisting remote registration update");
            }
        }
    }
private synchronized void updateRegistration ( final int regId ) { final Collection < PersistentData > regCollection = m_Datastore . query ( getClass ( ) , String . valueOf ( regId ) ) ; if ( ! regCollection . isEmpty ( ) ) { final PersistentData data = regCollection . iterator ( ) . next ( ) ; final byte [ ] bytes = ( byte [ ] ) data . getEntity ( ) ; final PersistentEventRegistrationMessage oldMessage ; try { oldMessage = PersistentEventRegistrationMessage . parseFrom ( bytes ) ; } catch ( final IOException e ) { m_Logging . error ( e , "Unable to update a remote event registration with ID %s from the datastore." , data . getDescription ( ) ) ; return ; } final PersistentEventRegistrationMessage updatedMessage = PersistentEventRegistrationMessage . newBuilder ( oldMessage ) . setRemainingExpirationTimeHours ( ( int ) m_Registrations . getRemainingTime ( regId , TimeUnit . HOURS ) ) . build ( ) ; data . setEntity ( updatedMessage . toByteArray ( ) ) ; try { m_Datastore . merge ( data ) ; } catch ( final Exception e ) { m_Logging . error ( e , "Error persisting remote registration update" ) ; } } }
Update the remaining expiration time for a remote event registration.
Update the remaining expiration time for a remote event registration .
// get existing message to update // skip