Changeset 34
- Timestamp:
- 06/10/13 18:09:19 (11 years ago)
- Location:
- trunk/objectmq
- Files:
-
- 2 added
- 4 deleted
- 13 edited
- 17 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/objectmq/.classpath
r27 r34 9 9 <classpathentry kind="lib" path="lib/rabbitmq-client.jar"> 10 10 <attributes> 11 <attribute name="javadoc_location" value="file:/home/sergi/ Documentos/Sergi/Java/workspace/objectmq/lib/rabbitmq-java-client-javadoc-3.0.1/"/>11 <attribute name="javadoc_location" value="file:/home/sergi/workspace/Java/objectmq/lib/rabbitmq-java-client-javadoc-3.0.1/"/> 12 12 </attributes> 13 13 </classpathentry> -
trunk/objectmq/src/omq/client/listener/ResponseListener.java
r20 r34 1 package omq.client. remote.response;1 package omq.client.listener; 2 2 3 import java.io.IOException; 3 4 import java.util.Hashtable; 4 5 import java.util.Map; … … 6 7 7 8 import omq.client.proxy.Proxymq; 8 import omq.common. remote.RemoteListener;9 import omq.common.util.OmqConnectionFactory; 9 10 import omq.common.util.ParameterQueue; 10 11 11 12 import com.rabbitmq.client.AMQP.BasicProperties; 13 import com.rabbitmq.client.Channel; 14 import com.rabbitmq.client.Connection; 12 15 import com.rabbitmq.client.ConsumerCancelledException; 13 16 import com.rabbitmq.client.QueueingConsumer; … … 22 25 * 23 26 */ 24 public class ResponseListener extends RemoteListener{27 public class ResponseListener extends Thread { 25 28 private static ResponseListener rListener; 29 30 private Connection connection; 31 private Channel channel; 32 private QueueingConsumer consumer; 33 private boolean killed = false; 26 34 private Map<String, Map<String, byte[]>> results; 27 35 … … 33 41 */ 34 42 protected ResponseListener(Properties env) throws Exception { 35 super(env); 43 connection = OmqConnectionFactory.getNewConnection(env); 44 channel = connection.createChannel(); 45 36 46 // Init the hashtable (it's concurrent) 37 47 this.results = new Hashtable<String, Map<String, byte[]>>(); … … 63 73 64 74 // Stores the new response 65 Map<String, byte[]> proxyResults = results.get(props.getAppId()); 75 Map<String, byte[]> proxyResults = results 76 .get(props.getAppId()); 66 77 67 78 // Put the result into the proxy results and notify him … … 108 119 * @throws Exception 109 120 */ 110 public static ResponseListener getRequestListener(Properties env) throws Exception { 121 public static ResponseListener getRequestListener(Properties env) 122 throws Exception { 111 123 if (rListener == null) { 112 124 rListener = new ResponseListener(env); … … 136 148 return rListener; 137 149 } 150 151 public synchronized Channel getChannel() throws Exception { 152 return connection.createChannel(); 153 } 138 154 139 155 /** … … 156 172 } 157 173 174 /** 175 * Interrupt and kill the Thread 176 * 177 * @throws IOException 178 */ 179 public void kill() throws IOException { 180 interrupt(); 181 killed = true; 182 channel.close(); 183 connection.close(); 184 } 185 158 186 // Revisar això 159 187 public void registerProxy(Proxymq proxy) { -
trunk/objectmq/src/omq/client/proxy/Proxymq.java
r30 r34 6 6 import java.lang.reflect.Proxy; 7 7 import java.util.Collection; 8 import java.util.Date;9 8 import java.util.HashMap; 10 9 import java.util.Hashtable; … … 15 14 import omq.client.annotation.AsyncMethod; 16 15 import omq.client.annotation.SyncMethod; 17 import omq.client. remote.response.ResponseListener;16 import omq.client.listener.ResponseListener; 18 17 import omq.common.event.Event; 19 18 import omq.common.event.EventDispatcher; -
trunk/objectmq/src/omq/common/broker/Broker.java
r30 r34 5 5 6 6 import omq.Remote; 7 import omq.client.listener.ResponseListener; 7 8 import omq.client.proxy.Proxymq; 8 import omq.client.remote.response.ResponseListener;9 9 import omq.common.event.Event; 10 10 import omq.common.event.EventDispatcher; … … 18 18 import omq.exception.RemoteException; 19 19 import omq.exception.SerializerException; 20 import omq.server. remote.request.RemoteObject;20 import omq.server.RemoteObject; 21 21 22 22 import com.rabbitmq.client.Channel; -
trunk/objectmq/src/omq/common/util/ParameterQueue.java
r24 r34 12 12 */ 13 13 14 public static String SERIALIZERNAME = " revo.serializer";15 public static String ENABLECOMPRESSION = " revo.compression";14 public static String SERIALIZERNAME = "omq.serializer"; 15 public static String ENABLECOMPRESSION = "omq.compression"; 16 16 17 public static String SERVER_HOST = " revo.host";18 public static String SERVER_PORT = " revo.port";19 public static String SERVER_REGISTRY = " revo.registry";17 public static String SERVER_HOST = "omq.host"; 18 public static String SERVER_PORT = "omq.port"; 19 public static String SERVER_REGISTRY = "omq.registry"; 20 20 21 public static String USER_NAME = " revo.username";22 public static String USER_PASS = " revo.pass";21 public static String USER_NAME = "omq.username"; 22 public static String USER_PASS = "omq.pass"; 23 23 24 public static String RPC_EXCHANGE = "revo.rpc_exchange"; 25 public static String RPC_QUEUE = "revo.rpc_queue"; 26 public static String RPC_ROUTING_KEY = "revo.routing_key"; 24 public static String RPC_EXCHANGE = "omq.rpc_exchange"; 27 25 28 public static String RPC_REPLY_QUEUE = " revo.reply_queue_rpc";29 public static String EVENT_REPLY_QUEUE = " revo.reply_queue_event";26 public static String RPC_REPLY_QUEUE = "omq.reply_queue_rpc"; 27 public static String EVENT_REPLY_QUEUE = "omq.reply_queue_event"; 30 28 31 public static String ENABLE_SSL = " revo.enable_ssl";32 public static String DEBUGFILE = " revo.debug_file";29 public static String ENABLE_SSL = "omq.enable_ssl"; 30 public static String DEBUGFILE = "omq.debug_file"; 33 31 34 32 public static String RETRY_TIME_CONNECTION = "omq.retry_connection"; -
trunk/objectmq/src/omq/common/util/Serializer.java
r19 r34 10 10 import omq.exception.EnvironmentException; 11 11 import omq.exception.SerializerException; 12 import omq.server. remote.request.RemoteObject;12 import omq.server.RemoteObject; 13 13 14 14 /** -
trunk/objectmq/src/omq/common/util/Serializers/GsonImp.java
r25 r34 7 7 import omq.common.message.Response; 8 8 import omq.exception.SerializerException; 9 import omq.server. remote.request.RemoteObject;9 import omq.server.RemoteObject; 10 10 11 11 import com.google.gson.Gson; -
trunk/objectmq/src/omq/common/util/Serializers/ISerializer.java
r14 r34 5 5 import omq.common.message.Response; 6 6 import omq.exception.SerializerException; 7 import omq.server. remote.request.RemoteObject;7 import omq.server.RemoteObject; 8 8 9 9 /** -
trunk/objectmq/src/omq/common/util/Serializers/JavaImp.java
r31 r34 11 11 import omq.common.message.Response; 12 12 import omq.exception.SerializerException; 13 import omq.server. remote.request.RemoteObject;13 import omq.server.RemoteObject; 14 14 15 15 /** -
trunk/objectmq/src/omq/common/util/Serializers/KryoImp.java
r25 r34 12 12 import omq.common.message.Response; 13 13 import omq.exception.SerializerException; 14 import omq.server. remote.request.RemoteObject;14 import omq.server.RemoteObject; 15 15 16 16 /** -
trunk/objectmq/src/omq/server/InvocationThread.java
r31 r34 1 package omq.server .remote.request;1 package omq.server; 2 2 3 3 import java.util.concurrent.BlockingQueue; -
trunk/objectmq/src/omq/server/RemoteObject.java
r31 r34 1 package omq.server .remote.request;1 package omq.server; 2 2 3 3 import java.io.IOException; -
trunk/objectmq/src/omq/server/RemoteWrapper.java
r31 r34 1 package omq.server .remote.request;1 package omq.server; 2 2 3 3 import java.util.ArrayList; -
trunk/objectmq/test/calculatorTest/Calculator.java
r31 r34 1 package omq.ztest.calculator;1 package calculatorTest; 2 2 3 3 import java.io.IOException; -
trunk/objectmq/test/calculatorTest/CalculatorImpl.java
r31 r34 1 package omq.ztest.calculator;1 package calculatorTest; 2 2 3 3 import java.io.IOException; … … 6 6 import omq.common.broker.Broker; 7 7 import omq.exception.SerializerException; 8 import omq.server. remote.request.RemoteObject;8 import omq.server.RemoteObject; 9 9 10 10 public class CalculatorImpl extends RemoteObject implements Calculator { -
trunk/objectmq/test/calculatorTest/ClientTest.java
r31 r34 1 package omq.ztest.calculator;1 package calculatorTest; 2 2 3 3 import static org.junit.Assert.assertEquals; -
trunk/objectmq/test/calculatorTest/Message.java
r31 r34 1 package omq.ztest.calculator;1 package calculatorTest; 2 2 3 3 import java.io.Serializable; -
trunk/objectmq/test/calculatorTest/ServerTest.java
r31 r34 1 package omq.ztest.calculator;1 package calculatorTest; 2 2 3 3 import java.util.Properties; -
trunk/objectmq/test/calculatorTest/ZeroEvent.java
r31 r34 1 package omq.ztest.calculator;1 package calculatorTest; 2 2 3 3 import omq.common.event.Event; -
trunk/objectmq/test/calculatorTest/ZeroListener.java
r31 r34 1 package omq.ztest.calculator;1 package calculatorTest; 2 2 3 3 import omq.common.event.EventListener; … … 5 5 public class ZeroListener extends EventListener<ZeroEvent> { 6 6 7 public ZeroListener(String topic) {7 public ZeroListener(String topic) { 8 8 super(topic); 9 9 } 10 10 11 11 @Override 12 12 public void notifyEvent(ZeroEvent event) { 13 13 System.out.println(event.getZeroMessage()); 14 14 } 15 16 15 } -
trunk/objectmq/test/farmTest/Animal.java
r31 r34 1 package omq.ztest.farm;1 package farmTest; 2 2 3 3 import java.io.Serializable; -
trunk/objectmq/test/farmTest/Cow.java
r31 r34 1 package omq.ztest.farm;1 package farmTest; 2 2 3 3 public class Cow implements Animal { -
trunk/objectmq/test/farmTest/Farm.java
r31 r34 1 package omq.ztest.farm;1 package farmTest; 2 2 3 3 import omq.Remote; -
trunk/objectmq/test/farmTest/FarmImpl.java
r31 r34 1 package omq.ztest.farm;1 package farmTest; 2 2 3 import omq.server. remote.request.RemoteObject;3 import omq.server.RemoteObject; 4 4 5 5 public class FarmImpl extends RemoteObject implements Farm { -
trunk/objectmq/test/farmTest/FarmTest.java
r31 r34 1 package omq.ztest.farm;1 package farmTest; 2 2 3 3 import static org.junit.Assert.assertEquals; … … 28 28 // listen to. 29 29 env.setProperty(ParameterQueue.RPC_EXCHANGE, "rpc_exchange"); 30 env.setProperty(ParameterQueue.RPC_QUEUE, "rpc_queue");31 env.setProperty(ParameterQueue.RPC_ROUTING_KEY, "rpc");32 30 33 31 farm = new FarmImpl(); … … 49 47 // Set info about where the message will be sent 50 48 env.setProperty(ParameterQueue.RPC_EXCHANGE, "rpc_exchange"); 51 env.setProperty(ParameterQueue.RPC_ROUTING_KEY, "rpc");52 49 53 50 // Set info about the queue & the exchange where the ResponseListener -
trunk/objectmq/test/farmTest/Pig.java
r31 r34 1 package omq.ztest.farm;1 package farmTest; 2 2 3 3 public class Pig implements Animal { -
trunk/objectmq/test/test/ClientImpl.java
r27 r34 9 9 import omq.common.broker.Broker; 10 10 import omq.exception.RemoteException; 11 import omq.server. remote.request.RemoteObject;11 import omq.server.RemoteObject; 12 12 13 13 public class ClientImpl extends RemoteObject implements Client { -
trunk/objectmq/test/test2/CarImpl.java
r29 r34 5 5 import omq.common.broker.Broker; 6 6 import omq.exception.RemoteException; 7 import omq.server. remote.request.RemoteObject;7 import omq.server.RemoteObject; 8 8 9 9 public class CarImpl extends RemoteObject implements Car { -
trunk/objectmq/test/test2/MobileImpl.java
r29 r34 4 4 import java.util.List; 5 5 6 import omq.server. remote.request.RemoteObject;6 import omq.server.RemoteObject; 7 7 8 8 public class MobileImpl extends RemoteObject implements Mobile {
Note: See TracChangeset
for help on using the changeset viewer.