How to findout which components are not serializable in cluster env

private void serializableCheck(Object o, String objName) {
System.out.println("The Object is >>>"+objName);
try{
ByteArrayOutputStream out = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(out);
oos.writeObject(o);
oos.close();
if (out.toByteArray().length > 0){
System.out.println("SERIALIZABLE");
}else {
System.out.println("NOT SERIALIZABLE");
}
} catch (IOException io){
io.printStackTrace();
}
}

猜你喜欢

转载自e-soft.iteye.com/blog/1600638
env