Package org.saf.remote

Source Code of org.saf.remote.RemoteClientConsumer

package org.saf.remote;

import java.util.ArrayList;
import org.apache.log4j.Logger;
import org.saf.business.RemoteAction;
import org.saf.business.RemoteNode;
import org.saf.business.RemoteNodeRmiData;
import org.saf.consumer.ConsumerThread;
import org.saf.settings.RemoteSettings;


public abstract class RemoteClientConsumer extends ConsumerThread<RemoteAction> {

  protected static final Logger logger =
    Logger.getLogger(RemoteClientConsumer.class)
 
  protected RemoteSettings settings = null;
  protected ArrayList<RemoteNodeRmiData> rmiNodes = null;
 
  public RemoteClientConsumer(RemoteSettings settings) {
    init(settings);
 
 
  @Override
  protected void process(RemoteAction info) {
    customSend(info);
  }

  @Override
  protected void processOnSafeStop(RemoteAction info) {
    // TODO Auto-generated method stub

  }

  @Override
  protected void processUnsuccessfuls(RemoteAction info) {
    // TODO Auto-generated method stub

  }

  private void init(RemoteSettings settings) {
    this.settings = settings;
    ArrayList<RemoteNode> nodes = this.settings.getNodes();
    this.rmiNodes = new ArrayList<RemoteNodeRmiData>(nodes.size());
    for(int i = 0; i < nodes.size(); i++) {
      RemoteNodeRmiData rmiNode =
        new RemoteNodeRmiData(nodes.get(i));
      this.rmiNodes.add(rmiNode);
     
      RemoteUtility.registerToRmiNode(rmiNode);
    }
  }
 
  protected abstract void customSend(RemoteAction info);
 

}
TOP

Related Classes of org.saf.remote.RemoteClientConsumer

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.