Examples of Replicator


Examples of org.apache.lucene.replicator.Replicator

      action = ReplicationAction.valueOf(pathElements[ACTION_IDX].toUpperCase(Locale.ENGLISH));
    } catch (IllegalArgumentException e) {
      throw new ServletException("Unsupported action provided: " + pathElements[ACTION_IDX]);
    }
   
    final Replicator replicator = replicators.get(pathElements[SHARD_IDX]);
    if (replicator == null) {
      throw new ServletException("unrecognized shard ID " + pathElements[SHARD_IDX]);
    }
   
    ServletOutputStream resOut = resp.getOutputStream();
    try {
      switch (action) {
        case OBTAIN:
          final String sessionID = extractRequestParam(req, REPLICATE_SESSION_ID_PARAM);
          final String fileName = extractRequestParam(req, REPLICATE_FILENAME_PARAM);
          final String source = extractRequestParam(req, REPLICATE_SOURCE_PARAM);
          InputStream in = replicator.obtainFile(sessionID, source, fileName);
          try {
            copy(in, resOut);
          } finally {
            in.close();
          }
          break;
        case RELEASE:
          replicator.release(extractRequestParam(req, REPLICATE_SESSION_ID_PARAM));
          break;
        case UPDATE:
          String currVersion = req.getParameter(REPLICATE_VERSION_PARAM);
          SessionToken token = replicator.checkForUpdate(currVersion);
          if (token == null) {
            resOut.write(0); // marker for null token
          } else {
            resOut.write(1); // marker for null token
            token.serialize(new DataOutputStream(resOut));
View Full Code Here

Examples of org.apache.lucene.replicator.Replicator

    reader = newReader;
  }
 
  @Test
  public void testBasic() throws Exception {
    Replicator replicator = new HttpReplicator(host, port, ReplicationService.REPLICATION_CONTEXT + "/s1",
        getClientConnectionManager());
    ReplicationClient client = new ReplicationClient(replicator, new IndexReplicationHandler(handlerIndexDir, null),
        new PerSessionDirectoryFactory(clientWorkDir));
   
    publishRevision(1);
View Full Code Here

Examples of org.apache.lucene.replicator.Replicator

    reader = newReader;
  }
 
  @Test
  public void testBasic() throws Exception {
    Replicator replicator = new HttpReplicator(host, port, ReplicationService.REPLICATION_CONTEXT + "/s1",
        getClientConnectionManager());
    ReplicationClient client = new ReplicationClient(replicator, new IndexReplicationHandler(handlerIndexDir, null),
        new PerSessionDirectoryFactory(clientWorkDir));
   
    publishRevision(1);
View Full Code Here

Examples of org.apache.lucene.replicator.Replicator

  @Test 
  public void testServerErrors() throws Exception {
    // tests the behaviour of the client when the server sends an error
    // must use BasicClientConnectionManager to test whether the client is closed correctly
    BasicHttpClientConnectionManager conMgr = new BasicHttpClientConnectionManager();
    Replicator replicator = new HttpReplicator(host, port, ReplicationService.REPLICATION_CONTEXT + "/s1", conMgr);
    ReplicationClient client = new ReplicationClient(replicator, new IndexReplicationHandler(handlerIndexDir, null),
        new PerSessionDirectoryFactory(clientWorkDir));
   
    try {
      publishRevision(5);
View Full Code Here

Examples of org.apache.lucene.replicator.Replicator

    reader = newReader;
  }
 
  @Test
  public void testBasic() throws Exception {
    Replicator replicator = new HttpReplicator(host, port, ReplicationService.REPLICATION_CONTEXT + "/s1",
        getClientConnectionManager());
    ReplicationClient client = new ReplicationClient(replicator, new IndexReplicationHandler(handlerIndexDir, null),
        new PerSessionDirectoryFactory(clientWorkDir));
   
    publishRevision(1);
View Full Code Here

Examples of org.apache.lucene.replicator.Replicator

      action = ReplicationAction.valueOf(pathElements[ACTION_IDX].toUpperCase(Locale.ENGLISH));
    } catch (IllegalArgumentException e) {
      throw new ServletException("Unsupported action provided: " + pathElements[ACTION_IDX]);
    }
   
    final Replicator replicator = replicators.get(pathElements[SHARD_IDX]);
    if (replicator == null) {
      throw new ServletException("unrecognized shard ID " + pathElements[SHARD_IDX]);
    }
   
    ServletOutputStream resOut = resp.getOutputStream();
    try {
      switch (action) {
        case OBTAIN:
          final String sessionID = extractRequestParam(req, REPLICATE_SESSION_ID_PARAM);
          final String fileName = extractRequestParam(req, REPLICATE_FILENAME_PARAM);
          final String source = extractRequestParam(req, REPLICATE_SOURCE_PARAM);
          InputStream in = replicator.obtainFile(sessionID, source, fileName);
          try {
            copy(in, resOut);
          } finally {
            in.close();
          }
          break;
        case RELEASE:
          replicator.release(extractRequestParam(req, REPLICATE_SESSION_ID_PARAM));
          break;
        case UPDATE:
          String currVersion = req.getParameter(REPLICATE_VERSION_PARAM);
          SessionToken token = replicator.checkForUpdate(currVersion);
          if (token == null) {
            resOut.write(0); // marker for null token
          } else {
            resOut.write(1); // marker for null token
            token.serialize(new DataOutputStream(resOut));
View Full Code Here

Examples of org.jboss.messaging.core.contract.Replicator

         // a bit messy but we have a circular dependency POJOContainer should be able to help us
         // here. Yes, this is nasty.

         if (postOffice.isClustered())
         {
            Replicator rep = (Replicator)postOffice;

            connFactoryJNDIMapper.injectReplicator(rep);

            // Also inject into the cluster connection manager
View Full Code Here

Examples of org.jboss.messaging.core.contract.Replicator

         //Also if it is clustered we must disallow unsubscribing if it has active consumers on other nodes

         if (sub.isClustered() && postOffice.isClustered())
         {
           Replicator rep = (Replicator)postOffice;

           Map map = rep.get(sub.getName());

           if (!map.isEmpty())
           {
             throw new IllegalStateException("Cannot unsubscribe durable subscription " +
                     subscriptionName + " since it has active subscribers on other nodes");
View Full Code Here

Examples of org.jboss.messaging.core.contract.Replicator

        //This is also used to prevent a possible race condition where a clustered durable sub is bound on all nodes
        //but then unsubscribed before the bind is complete on all nodes, leaving it bound on some nodes and not on others
        //The bind all is synchronous so by the time we add the x to the replicator we know it is bound on all nodes
        //and same to unsubscribe

        Replicator rep = (Replicator)postOffice;

        rep.put(queue.getName(), DUR_SUB_STATE_CONSUMERS);
      }

      ConsumerAdvised advised;

      // Need to synchronized to prevent a deadlock
View Full Code Here

Examples of org.jboss.messaging.core.contract.Replicator

         // a bit messy but we have a circular dependency POJOContainer should be able to help us
         // here. Yes, this is nasty.

         if (postOffice.isClustered())
         {
            Replicator rep = (Replicator)postOffice;

            connFactoryJNDIMapper.injectReplicator(rep);

            // Also inject into the cluster connection manager
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.