1 46 47 package org.mr.core.net; 48 49 import java.net.InetAddress ; 50 import java.net.InetSocketAddress ; 51 import java.nio.channels.SocketChannel ; 52 import java.util.List ; 53 54 import org.mr.core.stats.StatManager; 55 56 68 69 public class IndirectTransport extends Transport { 70 private Transport master; 71 72 public IndirectTransport(TransportInfo info, String myAgentName, 73 String remoteAgentName, NetworkListener listener, 74 StatManager statManager, 75 NetworkSelector selector, Transport master) 76 { 77 super(info, myAgentName, remoteAgentName, listener, statManager, 78 selector, false); 79 this.master = master; 80 } 81 82 public void createImpls() { 83 } 85 86 public boolean isConnected() { 87 return this.master.isConnected(); 88 } 89 90 public boolean isInitialized() { 91 return this.master.isInitialized(); 92 } 93 94 public void setInitialized(InetAddress local, boolean initId) { 95 } 97 98 public void finishedConnecting(SocketChannel channel) { 99 } 101 102 void finishedConnecting(TransportImpl impl) { 103 } 105 106 public void shutdown() { 107 } 109 110 public void sendMantaMessage(CNLMessage cnlMessage) { 111 this.master.sendMantaMessage(cnlMessage); 112 } 113 114 public void mergeImpl(TransportImpl newImpl, boolean initId) { 115 } 117 118 public void acceptedChannel(SocketChannel channel) { 119 } 121 122 public void acceptedImpl(TransportImpl impl) { 123 } 125 126 public void messageReady(CNLMessage message) { 127 } 129 130 public List getConnectedImpls() { 131 return this.master.getConnectedImpls(); 132 } 133 134 136 public void keepalive() { 137 if (this.stateListener != null) { 138 if (this.master.isInitialized()) { 139 this.stateListener.transportUp(this); 140 } else { 141 this.stateListener.transportDown(this); 142 } 143 } 144 } 145 146 public boolean isIndirect() { 147 return true; 148 } 149 150 public void activityDetected() { 151 } 153 154 public void implShutdown() { 155 } 157 158 public InetSocketAddress getLocalSocketAddress() { 159 return this.master.getLocalSocketAddress(); 160 } 161 } | Popular Tags |