????Java ?????л??????????FoxGlove ????????????????????????????????????????????????????????????????
???????????????????????? Apache commons-collections?? Apache xalan ?? Groovy ???У????ζ?????????Щ?????????(????????WebSphere?? WebLogic??JBoss)???????????(Spring??Groovy)???????????(Jenkins)?????????????Щ?????????????????/?????????Щ???????????????в?????????????????????????
???????????????????????????? Java ???л??????????????????????л????????? Java ????????????????????洢?????????????Java ?????????????????????л??????????????? Java ????????????????л???????????????????? writeObject ?? readObject ?????????????? readObject ?????????????? Java ???????????ù????????? ???ζ??????κ???????飬????????д readObject() ????????κ??????е???????
??????????????????????
????1. ???л???????????????????????δ??????????????????δ???????? ????:
class Client {
private int value;
public Client(int v) {
if (v <= 0) {
throw new RuntimeException("not positive number");
}
value = v;
}
public void writeObject(ObjectOutputStream oos) throws IOException {
int value = 0; //???????????0????????п?????????????????serialize????????class instrument??????????????
oos.defaultWriteObject();
}
}
class Controller {
private ArrayBlockingQueue<Client> queue;
public void receiveState(ObjectInputStream o) throws IOException?? ClassNotFoundException {
Client s = (Client)o.readObject(); //?????л??????ù???????value??????鯔????
queue.add(s);
}
public Client getClient() throws InterruptedException {
return (Client)queue.take();
}
}
class Server extends Thread {
private Controller controller = new Controller();
private int result = 100;
public void run() {
while (true) {
try {
result = result / controller.getClient().getValue(); // ????value??0????????????????????
Thread.sleep(100);
} catch (InterruptedException e) {}
}
}
}