Package org.hornetq.core.persistence

Examples of org.hornetq.core.persistence.OperationContext


      }
   }

   private void replicated()
   {
      OperationContext ctx = pendingTokens.poll();

      if (ctx == null)
      {
         throw new IllegalStateException("Missing replication token on the queue.");
      }

      ctx.replicationDone();
   }
View Full Code Here


      return getContext(null);
   }
  
   public static OperationContext getContext(final ExecutorFactory executorFactory)
   {
      OperationContext token = OperationContextImpl.threadLocalContext.get();
      if (token == null)
      {
         if (executorFactory == null)
         {
            return null;
View Full Code Here

         sync();
      }

      void sync() throws Exception
      {
         OperationContext originalTX = OperationContextImpl.getContext();

         try
         {
            // We only want to sync paging here, no need to wait for any other events
            OperationContextImpl.clearContext();

            for (PagingStore store : storesToSync)
            {
               store.sync();
            }

            // We can't perform a commit/sync on the journal before we can assure page files are synced or we may get
            // out of sync
            OperationContext ctx = OperationContextImpl.getContext();

            if (ctx != null)
            {
               // if null it means there were no operations done before, hence no need to wait any completions
               ctx.waitCompletion();
            }
         }
         finally
         {
            OperationContextImpl.setContext(originalTX);
View Full Code Here

      if (securityStore != null)
      {
         securityStore.authenticate(username, password);
      }
      final OperationContext context = storageManager.newContext(getExecutorFactory().getExecutor());
      final ServerSessionImpl session = internalCreateSession(name, username, password, minLargeMessageSize, connection, autoCommitSends, autoCommitAcks, preAcknowledge, xa, defaultAddress, callback, context);

      sessions.put(name, session);

      return session;
View Full Code Here

      // since sendLiveIsStoping my issue a close back from the channel
      // and we want to ensure a stop here just in case
      ReplicationManager replicatorInUse = replicator;
      if (replicatorInUse != null)
      {
         final OperationContext token = replicator.sendLiveIsStopping(LiveStopping.FAIL_OVER);
         if (token != null)
         {
            try
            {
               token.waitCompletion(5000);
            }
            catch (Exception e)
            {
               // ignore it
            }
View Full Code Here

      return name;
   }

   public Response propose(final Proposal proposal) throws Exception
   {
      OperationContext originalCtx = storageManager.getContext();

      try
      {
         // the waitCompletion cannot be done inside an ordered executor or we would starve when the thread pool is full
         storageManager.setContext(storageManager.newSingleThreadContext());
View Full Code Here

      // since sendLiveIsStoping my issue a close back from the channel
      // and we want to ensure a stop here just in case
      ReplicationManager replicatorInUse = replicator;
      if (replicatorInUse != null)
      {
         final OperationContext token = replicator.sendLiveIsStopping(LiveStopping.FAIL_OVER);
         if (token != null)
         {
            try
            {
               token.waitCompletion(5000);
            }
            catch (Exception e)
            {
               // ignore it
            }
View Full Code Here

   {
      synchronized (replicationLock)
      {
         while (!pendingTokens.isEmpty())
         {
            OperationContext ctx = pendingTokens.poll();
            try
            {
               ctx.replicationDone();
            }
            catch (Throwable e)
            {
               HornetQServerLogger.LOGGER.errorCompletingCallbackOnReplicationManager(e);
            }
View Full Code Here

   {
      if (!enabled)
         return null;
      boolean runItNow = false;

      OperationContext repliToken = OperationContextImpl.getContext(executorFactory);
      if (lineUp)
      {
         repliToken.replicationLineUp();
      }

      synchronized (replicationLock)
      {
         if (enabled)
         {
            pendingTokens.add(repliToken);
            replicatingChannel.send(packet);
         }
         else
         {
            // Already replicating channel failed, so just play the action now
            runItNow = true;
         }
      }

      // Execute outside lock

      if (runItNow)
      {
         repliToken.replicationDone();
      }

      return repliToken;
   }
View Full Code Here

    *                               response. If your packets are triggering this exception, it may be because the
    *                               packets were not sent with {@link #sendReplicatePacket(Packet)}.
    */
   private void replicated()
   {
      OperationContext ctx = pendingTokens.poll();

      if (ctx == null)
      {
         throw new IllegalStateException("Missing replication token on the queue.");
      }

      ctx.replicationDone();
   }
View Full Code Here

TOP

Related Classes of org.hornetq.core.persistence.OperationContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.