Changeset 72 for trunk/src/main/java/omq/common/util/Serializer.java
- Timestamp:
- 06/29/13 20:44:27 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/main/java/omq/common/util/Serializer.java
r62 r72 4 4 import java.util.Properties; 5 5 6 import omq.common.event.Event;7 6 import omq.common.message.Request; 8 7 import omq.common.message.Response; … … 48 47 try { 49 48 String className = env.getProperty(ParameterQueue.SERIALIZER_NAME, Serializer.JAVA); 50 49 51 50 if (className == null || className.isEmpty()) { 52 51 throw new ClassNotFoundException("Class name is null or empty."); 53 52 } 54 53 55 54 serializer = getInstance(className); 56 55 } catch (Exception ex) { … … 62 61 } 63 62 64 public ISerializer getInstance(String type) throws SerializerException { 63 public ISerializer getInstance(String type) throws SerializerException { 65 64 if (KRYO.equals(type)) { 66 65 if (kryoSerializer == null) { … … 79 78 return javaSerializer; 80 79 } 81 80 82 81 throw new SerializerException("Serializer not found."); 83 82 } … … 148 147 } 149 148 150 public Event deserializeEvent(byte[] bytes) throws SerializerException {151 ISerializer instance = getInstance();152 153 Boolean enableCompression = getEnableCompression();154 if (enableCompression) {155 try {156 byte[] unZippedBytes = Zipper.unzip(bytes);157 return instance.deserializeEvent(unZippedBytes);158 } catch (IOException e) {159 throw new SerializerException(e.getMessage(), e);160 }161 } else {162 return instance.deserializeEvent(bytes);163 }164 }165 166 // public static void removeSerializers() {167 // logger.warn("Removing serializers");168 // serializer = null;169 // kryoSerializer = null;170 // javaSerializer = null;171 // gsonSerializer = null;172 // }173 149 }
Note: See TracChangeset
for help on using the changeset viewer.