Changeset 62 for trunk/src/main/java/omq/common
- Timestamp:
- 06/26/13 11:20:06 (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property
svn:ignore
set to
target
-
Property
svn:ignore
set to
-
trunk/src/main/java/omq/common/util/Serializer.java
r53 r62 22 22 // private static final Logger logger = 23 23 // Logger.getLogger(Serializer.class.getName()); 24 public static final String kryo= "kryo";25 public static final String java= "java";26 public static final String gson= "gson";24 public static final String KRYO = "kryo"; 25 public static final String JAVA = "java"; 26 public static final String GSON = "gson"; 27 27 28 28 // Client serializer … … 47 47 if (serializer == null) { 48 48 try { 49 String className = env.getProperty(ParameterQueue.SERIALIZER_NAME, Serializer. java);50 49 String className = env.getProperty(ParameterQueue.SERIALIZER_NAME, Serializer.JAVA); 50 51 51 if (className == null || className.isEmpty()) { 52 52 throw new ClassNotFoundException("Class name is null or empty."); 53 53 } 54 54 55 55 serializer = getInstance(className); 56 56 } catch (Exception ex) { … … 62 62 } 63 63 64 public ISerializer getInstance(String type) throws SerializerException { 65 if ( kryo.equals(type)) {64 public ISerializer getInstance(String type) throws SerializerException { 65 if (KRYO.equals(type)) { 66 66 if (kryoSerializer == null) { 67 67 kryoSerializer = new KryoImp(); 68 68 } 69 69 return kryoSerializer; 70 } else if ( gson.endsWith(type)) {70 } else if (GSON.equals(type)) { 71 71 if (gsonSerializer == null) { 72 72 gsonSerializer = new GsonImp(); 73 73 } 74 74 return gsonSerializer; 75 } else {75 } else if (JAVA.equals(type)) { 76 76 if (javaSerializer == null) { 77 77 javaSerializer = new JavaImp(); … … 79 79 return javaSerializer; 80 80 } 81 82 throw new SerializerException("Serializer not found."); 81 83 } 82 84
Note: See TracChangeset
for help on using the changeset viewer.