Package org.jboss.fresh.events.net

Examples of org.jboss.fresh.events.net.EventNetRouter


    return null;
  }


  public synchronized void registerEventNetRouter(String agentid, EventNetRouter router) throws RegistrationException {
    EventNetRouter rt = (EventNetRouter) routers.get(agentid);
    if(rt != null) throw new RegistrationException("Router is already registered under the specified agentid: " + agentid + " (Either you should reuse existing one or there are more agents with same agentid - which should never be - which means wrong configuration.)");

    routers.put(agentid, router);
  }
View Full Code Here


    log.info("EC1 Listeners: " + ec.getListeners());
    log.info("EC1 Broadcasters: " + ec.getBroadcasters());

    // lookup EventNetRouter for our name
    EventNetRouter router = ec.getEventNetRouter(initorID);

//    Thread t = null;

log.info("=== processid: " + getProcess().getID());
    // if exists take over : tell it to stop, get Connector from it and set Buffers on it, then tell EventNetRouter to start
    if(router!=null) {
log.info("router != null  checkCon: " + checkCon + ", conID: " + conID + ", existing conID: " + router.getConID());
      if(checkCon && !conID.equals(router.getConID())) {
        try {
          error("Agent (" + conID + ") has been taken over by another agent (" + router.getConID() + ")");
        } catch(Exception e) {
          throw new TakenOverException(e.getMessage());
        }
        return;
      }
      router.setConID(conID);

log.info("Stopping current router ...");
      router.stop(true);
log.info("ok.  getting connector and replacing buffers ...");
      EventNetShellAgentConnector con = (EventNetShellAgentConnector) router.getConnector();
      con.setOutput(new BufferObjectWriter(getStdOut()));
      con.setInput(new BufferObjectReader(getStdIn()));
log.info("ok. Creating new ProcessorThread");
      router.start();
log.info("### YAK! This shouldn'0t happen :(.");
      return;

       // (this will take over our thread and our job is done)

    } else {
      // if it doesn't exist then we need to instanciate a new EventNetRouter and register it with EventCentral
      // Then do same things as with taking over which eventually takes executable's thread inside the last method we call.
      if(hostLabel == null) {
        error("Host not specified");
        return;
      }

      if(app==null) app = shell.getEnvProperty("PROJECT");

      router = new EventNetRouterImpl(ec, initorID, hostLabel, app, keepEvents);
      router.setConID(conID);
     
      //ec.registerEventNetRouter(initorID, router);
      EventNetShellAgentConnector con = new EventNetShellAgentConnector();
      con.setOutput(new BufferObjectWriter(getStdOut()));
      con.setInput(new BufferObjectReader(getStdIn()));

      router.setConnector(con);
      router.start();
//      t = new ProcessorThread(router);
//      t.start();
    }

View Full Code Here

TOP

Related Classes of org.jboss.fresh.events.net.EventNetRouter

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.