倪å€ã®æãããJavaã«ã¯çŽ æŽãããã·ãªã¢ã«åã¡ã«ããºã ããããç¹å¥ãªç²Ÿç¥çãªåŽåããããããšãªããä»»æã®è€éãªãªããžã§ã¯ãã°ã©ããäžé£ã®ãã€ããšããŠä¿åã§ããŸãã ã¹ãã¬ãŒãžåœ¢åŒã¯ååã«ææžåãããŠãããå€ãã®äŸããããã·ãªã¢ã«åããããªããžã§ã¯ãã¯ããªããéãããäžåºŠã«ãããã¯ãŒã¯çµç±ã§éä¿¡ãããã«ã¹ã¿ãã€ãºã®å€ãã®å¯èœæ§ããããŸã...ããã¯ãã¹ãŠçŽ æŽããããšæãããŸãããããªããé¡ãåãããŠããªãéãéåžžã«äŸ¡å€ããããçŸåšå¿
èŠãªããŒã¿ãå«ããã«ãã¡ã¬ãã€ãã®ãã€ããªãã¡ã€ã«ã
çŽ æã§ãã®ãã¡ã€ã«ã«ã¢ã¯ã»ã¹ããŠããœãŒã¹ã³ãŒããªãã§ãªããžã§ã¯ãã®ãã®å·šå€§ãªã·ãªã¢ã«åãããã°ã©ãã®å
éšã«ä¿åãããŠãããã®ãç解ããæ¹æ³ã¯ïŒ
Serialysisã¯ããããã®è³ªåãä»ã®å€ãã®è³ªåã«çããããšãã§ããŸã-ã·ãªã¢ã«åãããJavaãªããžã§ã¯ãã詳现ã«åæã§ããã©ã€ãã©ãªïŒ
ã·ãªã¢ã«åããã圢åŒã¯ãåŒã®ã·ãªã¢ã«åœ¢åŒã翻蚳ããç§ã®ããŒãžã§ã³ã§ãã ãã®ããããªããžã§ã¯ãã«é¢ããæ
å ±ãååŸã§ããŸããããã®æ
å ±ã¯ãããªãã¯APIããã¯å
¥æã§ããŸããã ãã®ã©ã€ãã©ãªã¯ãç¬èªã®ã¯ã©ã¹ã®ã·ãªã¢ã«åããã¹ããããšãã«ã䟿å©ãªããŒã«ã§ãã
翻蚳è
ããïŒåææ¥ å€æ¹ã ãã®æ¥ã®ä»äºãäºæããããã®ã¯äœããããŸããã§ããããçªç¶ãç§ã¯èªåã®ä»äºãhadoopã¯ã©ã¹ã¿ãŒã§ã©ã®ããã«ãªã£ãŠãããã確èªããŠãè¯å¿ãèœã¡çãããã®ã¯ããããšã ãšæããŸã-åé¡ã¯è§£æ±ºãããŸãã...
<æè©ã®äœè«>éå»æ°æ¥éã§ãæ¬çªç°å¢ã®hadoopã¯ã©ã¹ã¿ãŒã§OutOfMemoryErrorã䜿çšããŠããªãã®æ°ã®ã¿ã¹ã¯ãå®äºãå§ããå²ãåœãŠãããã¡ã¢ãªã®éãå¢ããæ©äŒããªããªã£ããããITéšéã¯çç±ãæ¢ãããšããŠããªãã®æéãè²»ãããŸããã ç§ãã¡ã®ã¢ã¡ãªã«äººã®ååãææ
®æ·±ãèšå®ãèŠãŠãããã€ãã®è¡ãä¿®æ£ããåé¡ã解決ãããšèšã£ããšããäºå®ã§çµãããŸããã
å®éãéææ¥ã«ã¯ãã¹ãŠãããŸããããŸããããŸãã
Clouderaèªå®ããããããŒãããŒã ã«
å ãã£ãããšãå¬ããæããŸãã
</åæ
çãªäœè«>ããããããã«ãããŸããïŒ
Khadupã¯ããã®äžå¹žãªåææ¥ã«1ã€ã®ã¿ã¹ã¯ãå®äºããªãã£ãããšã蚌èšããŸããã
ã¯ã©ãã·ã¥ã®çç±ã¯ä»¥åã®ãã®ãšã¯å€å°ç°ãªããŸããã¿ã¹ã¯ãã©ãã«ãŒã¯ãã¿ã¹ã¯æ§æã®xmlãã¡ã€ã«ãããŒãããã®ã«ååãªã¡ã¢ãªããªããããã¿ã¹ã¯ãéå§ã§ããŸããã§ããã
ãã¡ãããç§ã¯ããã«ã©ããªçš®é¡ã®å·šå€§ãªæ§æãããã«ä¿åãããŠããã®ã ãããšæããŸãããïŒ æ®å¿µãªããã倧éšåã¯50ã¡ã¬ãã€ãã®ã·ãªã¢ã«åããããããã§å ããããŠããŸããã ãããã¯ãããŸããŸãªã¯ã©ã¹ã®ãªããžã§ã¯ãã®ã°ã©ãã§æ§æãããŠããŸãããã¡ããããœãŒã¹ã¯ãããŸããã
åææ¥ã®å€æ¹ãå³èã®ããŒã«ã ãã§ãã®ãã«ãã¡ã¬ãã€ããã€ããªã䜿ã£ãŠäœãã§ããã§ããããïŒ
ç§ã®æäžäž»ãã·ãªã¢ãªã·ã¹ãæ¥ãŸããã æ°è¡ã®ã³ãŒã-ãããŠãã¯ã©ã¹ãšãã£ãŒã«ãã®ååãšãšãã«ãã·ãªã¢ã«åããããªããžã§ã¯ãã®å
éšã®å®å
šãªãã³ããæã«ããŠããŸãã æå
ã«å®å
šãªãã³ããããã®ã§ãåé¡ãèŠã€ããæååèŸæžã®gzipå§çž®ããªã³ã«ãã
JBEã䜿çšããŠã¯ã©ã¹ã«ããããé©çšããŸãã åºæ¥äžãã-åé¡ã¯è§£æ±ºããŸããïŒ
ãã¡ããããã¯ããã¯ã§ãããæã«ã¯ããã¯ãªãã§-ã©ãã«ããããŸããã
PSã©ã€ãã©ãªã¯é·å¹Žäœ¿çšãããŠããŸãããçŸæç¹ã§ã¯éåžžã«åœ¹ç«ã€ããšãå€æããŸããã ççŽã«èšã£ãŠãèè
ãã©ã€ãã©ãªçšã«èŠã€ããã¢ããªã±ãŒã·ã§ã³ã®ããã€ãã¯ãç§ã«ãšã£ãŠéåžžã«å¥åŠã«æããŸãã ç¥ã®ããã«ã圌ãã¯ç§ãã¡ã«æž¯ãç¥ãããªãã£ãã®ã§ãããã¯æ¬åœã«å¿
èŠã§ã¯ãããŸããïŒ ç§ã®æèŠã§ã¯ããã®ãã¯ãããžãŒã®æé©ãªã¢ããªã±ãŒã·ã§ã³ã¯ãããããçš®é¡ã®ãããã°ãšãã©ãã«ã·ã¥ãŒãã£ã³ã°ã§ãããã®åéã§ã¯ãæ¬åœã«åçã§ã¯ãããŸããã
å®éã«ã¯ãèšäºïŒãããªãã¯APIã§ååã§ãªãå Žå
Serialysisã©ã€ãã©ãªãäœæããçç±ã¯ããããªãã¯APIãä»ããŠååŸã§ããªãã£ãããã·ãªã¢ã«åããã圢åŒã§å©çšã§ãããªããžã§ã¯ãã«é¢ããæ
å ±ãå¿
èŠãªãšãã«ãããã€ãã®åé¡ã«ééããããã§ãã
ããšãã°ããªã¢ãŒãRMIãªããžã§ã¯ãã®ã¹ã¿ãããããã©ã®ã¢ãã¬ã¹ãŸãã¯ããŒããä»ããŠæ¥ç¶ãããããŸãã¯ã©ã®
RMIãœã±ãããã¡ã¯ããªïŒRMIClientSocketFactoryïŒã䜿çšããããç¥ããããšããŸãã æšæºã®RMI APIã¯ãã¹ã¿ãããæ
å ±ãæœåºããæ¹æ³ãæäŸããŸããã ã·ãªã¢ã«å解é€åŸã«ã¹ã¿ããæ©èœããã«ã¯ããã®æ
å ±ãã·ãªã¢ã«åããã圢åŒã§ååšããå¿
èŠããããŸãã ãããã£ãŠãã·ãªã¢ã«åãããã¹ã¿ããäœããã®æ¹æ³ã§ãã解æã§ããªãå Žåãå¿
èŠãªæ
å ±ãååŸã§ããŸãã
2çªç®ã®äŸã¯ã
JMX APIããã®ãã®ã§ãã MBeanãµãŒããŒãžã®ãªã¯ãšã¹ãã¯ã
QueryExpã€ã³ã¿ãŒãã§ãŒã¹ã§è¡šãããŸãã QueryExpã®äŸã¯ã
Queryã¯ã©ã¹ã¡ãœããã䜿çšããŠæ§ç¯ãããŸãã ãªããžã§ã¯ããQueryExpã«å±ããŠããå Žåããããå®è¡ããã¯ãšãªãã©ã®ããã«ç¥ãã®ã§ããïŒ JMX APIã«ã¯ãèŠã€ããæ¹æ³ããããŸããã æ
å ±ã¯ãã¯ã©ã€ã¢ã³ãããªã¢ãŒããµãŒããŒã«èŠæ±ãè¡ã£ããšãã«ãµãŒããŒã«åŸ©å
ã§ããããã«ãã·ãªã¢ã«åããã圢åŒã§æ瀺ããå¿
èŠããããŸãã ã·ãªã¢ã«åããããã©ãŒã ã確èªã§ããã°ããªã¯ãšã¹ããäœã§ãã£ãããå€æã§ããŸãã
2çªç®ã®äŸã¯ããã®ã©ã€ãã©ãªãäœæããããã«ä¿ããŸããã æ¢åã®æšæºJMXã³ãã¯ã¿ã¯Javaã·ãªã¢ã«åã«åºã¥ããŠãããããQueryExpsã®ç¹å¥ãªåŠçã¯å¿
èŠãããŸããã ããããæ°ããWebãµãŒãã¹ã§ã¯
JSR 262ã§å°å
¥ãããã³ãã¯ã¿ã¯ãã·ãªã¢ã«åã«XMLã䜿çšããŸãã QueryExpã解æããŠããXMLã«å€æããæ¹æ³ã¯ïŒ çãã¯ç°¡åã§ããWSã³ãã¯ã¿ã¯ããã®ã©ã€ãã©ãªã®ããŒãžã§ã³ã䜿çšããŠãã·ãªã¢ã«åãããQueryExpã®å
éšã調ã¹ãŸãã
ãããã®äŸã«ã¯ãã¹ãŠå
±éç¹ã1ã€ãããŸããããããã®APIã«ã¹ããŒã¹ã衚瀺ãããŠããŸãã ã€ãŸããRMIã¹ã¿ãããæ
å ±ãæœåºããã«ã¯ã¡ãœãããå¿
èŠã§ãã QueryExpãå€æããŠããããçæããå
ã®Queryã¡ãœããã«æ»ãæ¹æ³ãå¿
èŠãªããã«ã ïŒè§£æå¯èœãªæšæºã®toStringïŒïŒåºåã§ãååã§ãïŒã ããããçŸåšãã®ãããªã¡ãœããã¯ãããŸãããçŸåšã®åœ¢åŒã§ãããã®APIã§åäœããã³ãŒããå¿
èŠãªå Žåã¯ãå¥ã®ã¢ãããŒããå¿
èŠã§ãã
ãªããžã§ã¯ãã®ãã©ã€ããŒããã£ãŒã«ãã«äŸµå
¥ããŸã
èå³ã®ããã¯ã©ã¹ã®ãœãŒã¹ã³ãŒããããå Žåã¯ãç®çã®ããŒã¿ãååŸããŠååŸããã ãã§ãã RMIã¹ã¿ãã䜿çšããäŸã§ã¯ã
getRefïŒïŒã¹ã¿ãã¡ãœãããsun.rmi.server.UnicastRefãè¿ãããšãå®éšçã«ããããŸããJDKãœãŒã¹ã調ã¹ãçµæããã®ã¯ã©ã¹ã«ã¯sun.rmi.transport.LiveRefåã®refãã£ãŒã«ããå«ãŸããŠããããšãããããŸããå¿
èŠãªæ
å ±ã§ ãããã£ãŠããã®ã³ãŒãã®ãããªãã®ãåŸãããŸãïŒãã ããäºåã«èšã£ãŠãããŸããããããè¡ãã¹ãã§ã¯ãããŸããïŒã
import sun.rmi.server.*; import sun.rmi.transport.*; import java.rmi.*; import java.rmi.server.*; public class StubDigger { public static getPort(RemoteStub stub) throws Exception { RemoteRef ref = stub.getRef(); UnicastRef uref = (UnicastRef) ref; Field refField = UnicastRef.class.getDeclaredField("ref"); refField.setAccessible(true); LiveRef lref = (LiveRef) refField.get(uref); return lref.getPort(); } }
çµæã¯ããããããªãã«ãŽã£ããã§ãããããç¹°ãè¿ããŸãããããããããšã¯ãå§ãããŸãã-ãã®ã³ãŒãã¯è¯ããããŸããã ãŸãã倪éœãžã®äŸåé¢ä¿ã䜿çšããªãã§ãã ãã*ã¯ã©ã¹ãJDKã®æŽæ°ã«ãã£ãŠèªèãè¶
ããŠå€æŽãããªãããšãä¿èšŒã§ããªããããã¯ã©ã¹ã¯ä»ã®JDKãã©ãããã©ãŒã ã«ç§»æ€ããã®ã¯å®¹æã§ã¯ãããŸããã 次ã«ã
Field.setAccessibleã®ãããªãã®ã
衚瀺ãããã ãããã
äžæåæ¢ã®æšèãšããŠäœ¿çšããå¿
èŠããããŸãã ã€ãŸããã³ãŒãã¯ããªãªãŒã¹ããšã«å€æŽãããå¯èœæ§ã®ããææžåãããŠããªããã£ãŒã«ãã«äŸåããŠããããšãæå³ããŸãã
ïŒãã®ã³ãŒãã¯JDK 5åãã«äœæãããŸãããå€æããããã«ãJDK 6ã§ã¯LiveRefã¯public getPortïŒïŒã¡ãœãããååŸãããããField.setAccessibleã¯å¿
èŠãªããªããŸããããããããããã«ããŠãsunã«äŸåããã¹ãã§ã¯ãããŸããã
ãã¡ãããããè¯ã解決çãèŠã€ãããªãå ŽåããããŸãã ããããããªããçå£ã«èå³ãæã£ãŠããã¯ã©ã¹ãçŽååå¯èœã§ããããšãå€æããå Žåãæåããå¯èœæ§ã¯ååã«ãããŸãã å®éãã¯ã©ã¹ã®çŽååããã圢åŒã¯ãã®å¥çŽã®äžéšã§ãã APIãå®å
šã«æ¬ èœããŠããªãå Žåããã®å€éšã³ã³ãã©ã¯ãã¯ä»¥åã®ããŒãžã§ã³ãšäºææ§ããããŸãã ããã¯ãç¹ã«JDKãã©ãããã©ãŒã ã«ãšã£ãŠéåžžã«éèŠãªæ¡ä»¶ã§ãã
ãããã£ãŠãå¿
èŠãªæ
å ±ããããªãã¯ã¯ã©ã¹ã¡ãœãããä»ããŠã¢ã¯ã»ã¹ã§ããªãããå°ãªããšãææžåãããã·ãªã¢ã«åããã圢åŒã®äžéšã§ããå Žåãã·ãªã¢ã«åããã圢åŒã§å€æŽãããªããŸãŸã§ããããšãæãŸããŸãã
çŽååããã圢åŒã®èª¬æã¯ãå®è£
ãããåã¯ã©ã¹ã®ãé¢é£é
ç®ãã»ã¯ã·ã§ã³ã®Javadocã«å«ãŸããŠããŸãã 1ã€ã®å€§ããªããŒãžã§ããã¹ãŠã®ãããªãã¯JDKã¯ã©ã¹ã®ã·ãªã¢ã«åããã圢åŒãèŠã€ããããšãã§ããŸãã
ããã«ã¡ã¯SerialysisïŒ
ã·ãªã¢ã«åããããªããžã§ã¯ãã®ã¡ã¿ããŒã¿ãååŸããããã®ç§ã®ã©ã€ãã©ãªã¯ããã·ãªã¢ã«åæããšããèšèã®çµã¿åããããSerialysisãšåŒã°ããŸãã
ãããã©ã®ããã«æ©èœãããã®ç°¡åãªäŸãæããŸãã ãã®ã³ãŒã...
SEntity sint = SerialScan.examine(new Integer(5)); System.out.println(sint);
...ããããããã...
SObject(java.lang.Integer){ value = Prim(int){5} }
ããã¯ãSerialScan.examineã«æž¡ããjava.lang.Integeråã®ãªããžã§ã¯ãã¯ãintåã®åäžãã£ãŒã«ããå
éšã«æã€ãªããžã§ã¯ããšããŠã·ãªã¢ã«åãããããšã瀺åããŠããŸãã
ææžåãããçŽååããã圢åŒjava.lang.Integerããã§ãã¯ãããšãããããŸãã«äºæ³ããããã®ã§ããããšãããã
ãŸã ã
ãœãŒã¹ã³ãŒãjava.lang.IntegerãèŠããšãã¯ã©ã¹èªäœã«ãintåã®åäžã®å€ãã£ãŒã«ããããããšãããããŸãã
private final int value;
ãã ãããã©ã€ããŒããã£ãŒã«ãã¯å®è£
ã®è©³çŽ°ã§ãã æŽæ°ã§ã¯ããã£ãŒã«ãã®ååãå€æŽããããæ°ãããã£ãŒã«ãã«çœ®ãæãããã芪ã¯ã©ã¹
java.lang.Numberãªã©ããç¶æ¿ãããã§ã
ãŸã ã ãããŠããããèµ·ãããªããšããä¿èšŒã¯ãããŸããããçŽååããã圢åŒãå€æŽãããªããšããä¿èšŒããããŸãã
ã·ãªã¢ã«åã¯ãã¯ã©ã¹ã®ãã£ãŒã«ããå€æŽãããå Žåã§ã
ãã·ãªã¢ã«åããããã©ãŒã ãå
ã®ãã©ãŒã ã«
ä¿åãã
ã¡ã«ããºã ãæäŸããŸãã
ããã¯ãã£ãšè€éãªäŸã§ãã äœããã®çç±ã§ã
ArrayListå
ã®é
åã®å€§ãããç¥ããããšããŸãã APIã¯å¿
èŠãªæ
å ±ãæäŸã
ãŸããããæå®ãããé
å以äžã®é
åã匷å¶çã«å²ãåœãŠãããšãã§ããŸã
ãArrayListã®
ã·ãªã¢ã«åããã圢åŒãèŠããšãæ¢ããŠããæ
å ±ãå«ãŸããŠããããšãããããŸãã ããã¯ããªã¹ãå
ã®ã¢ã€ãã ã®æ°ã§ããã·ãªã¢ã«åããããã£ãŒã«ããµã€ãºã瀺ããŸãããããã¯å¿
èŠãªãã®ã§ã¯ãããŸããã ãã ããWriteObjectã¡ãœããã®ãã€ããªããŒã¿ã«ã¯ãå¿
èŠãªãã®ã ããå«ãŸããŠããŸãã
ã·ãªã¢ã«ããŒã¿ïŒå
éšArrayListã®é·ããããã³ãã®èåŸ-ãã¹ãŠã®èŠçŽ ïŒãããããªããžã§ã¯ããšããŠïŒãæå®ãããé åºã§å«ãŸããŠããŸãããã®ã³ãŒããå®è¡ãããš...
List<Integer> list = new ArrayList<Integer>(); list.add(5); SObject slist = (SObject) SerialScan.examine(list); System.out.println(slist);
...ãã®åŸã次ã®çµè«ãåŸãããŸã...
SObject(java.util.ArrayList){ size = SPrim(int){1} -- data written by class's writeObject: SBlockData(blockdata){4 bytes of binary data} SObject(java.lang.Integer){ value = SPrim(int){5} } }
ããã§ã¯ãã·ãªã¢ã«åã®æããžã£ã³ã°ã«ã«ããŸãã ãªããžã§ã¯ãã®ãã£ãŒã«ããã·ãªã¢ã«åããããšã«å ããŠããŸãã¯ãã®ä»£ããã«ãã¯ã©ã¹ã«ã¯ã
ObjectOutputStream.writeIntåã®ã¡ãœããã䜿çšããŠã¹ããªãŒã ã«ä»»æã®ããŒã¿ãæžã蟌ãwriteObjectïŒObjectOutputStreamïŒã¡ãœãããå«ããããšãã§ããŸãã ã¯ã©ã¹ã«ã¯ãåãããŒã¿ãèªã¿åã察å¿ããreadObjectã¡ãœãããå«ããå¿
èŠãããã
@ serialDataã¿ã°ã䜿çšã
㊠ãArrayListã§è¡ã£ãããã«ãWriteObjectã¡ãœãããæ£ç¢ºã«æžã蟌ãå
容ãææžåããå¿
èŠããããŸãã
Serialysisã®writeObjectããŒã¿ã¯ãListãè¿ãSObject.getAnnotationsïŒïŒã¡ãœãããä»ããŠååŸã§ããŸãã
ObjectOutputStream.writeObjectïŒObjectïŒã¡ãœããã䜿çšããŠèšé²ãããåãªããžã§ã¯ãã¯ããã®ãªã¹ãã«SObjectãšããŠè¡šç€ºãããŸãã
DataOutputããç¶æ¿ããObjectOutputStreamã¡ãœããïŒ
writeInt ã
writeUTFãªã©ïŒãžã®1ã€ä»¥äžã®é£ç¶ããåŒã³åºãã«ãã£ãŠèšé²ãããåããŒã¿ã¯ãSBlockDataãšããŠè¡šãããŸãã ã·ãªã¢ã«åãããã¹ããªãŒã ã§ã¯ããã®ããŒã¹å
ã®åã
ã®èŠçŽ ãéžæã§ããŸããã ãã®æ
å ±ã¯ã@ serialDataã¿ã°ã§ææžåããããã©ã€ã¿ãŒãšãªãŒããŒéã®åæã§ãã
ArrayListã®ããã¥ã¡ã³ãã«åºã¥ããŠã次ã®ããã«ããŠé
åã®ãµã€ãºãååŸã§ããŸãã
SObject slist = (SObject) SerialScan.examine(list); List<SEntity> writeObjectData = slist.getAnnotations(); SBlockData data = (SBlockData) writeObjectData.get(0); DataInputStream din = data.getDataInputStream(); int alen = din.readInt(); System.out.println("Array length: " + alen);
Serialysisããã¹ãã¿ã¹ã¯ã解決ããæ¹æ³
å®å
šãªãœãŒã¹ã³ãŒããçç¥ããŠãåé ã§è¿°ã¹ãQueryExpåé¡ã®è§£æ±ºçã®æŠèŠã®ã¿ã説æããŸãã QueryExpã次ã®ããã«æ§ç¯ãããŠãããšããŸãïŒ
QueryExp query = Query.or(Query.gt(Query.attr("Version"), Query.value(5)), Query.eq(Query.attr("SupportsSpume"), Query.value(true)));
ããã¯ããããŒãžã§ã³å±æ§ã5ãã倧ããããŸãã¯SupportsSpumeå±æ§ãtrueã®MBeanãæäŸããããšããæå³ã§ãã JDKã®ãã®ãªã¯ãšã¹ãã®toStringïŒïŒã¯æ¬¡ã®ããã«ãªããŸãã
((Version) > (5)) or ((SupportsSpume) = (true))
ãããŠãããã¯SerialScan.examineã®çµæãã©ã®ããã«èŠãããã§ãïŒ
SObject(javax.management.OrQueryExp){ exp1 = SObject(javax.management.BinaryRelQueryExp){ relOp = SPrim(int){0} exp1 = SObject(javax.management.AttributeValueExp){ attr = SString(String){"version"} } exp2 = SObject(javax.management.NumericValueExp){ val = SObject(java.lang.Long){ value = SPrim(long){5} } } } exp2 = SObject(javax.management.BinaryRelQueryExp){ relOp = SPrim(int){4} exp1 = SObject(javax.management.AttributeValueExp){ attr = SString(String){"supportsSpume"} } exp2 = SObject(javax.management.BooleanValueExp){ val = SPrim(boolean){true} } } }
ãã®æ§é ã«çªå
¥ããã³ãŒããæ³åããã®ã¯ç°¡åã§ãXMLã«çžåœãããã®ãäœæãããŸãã äºææ§ã®ããåJMX APIå®è£
ã¯ããŸã£ããåãã·ãªã¢ã«åããããã©ãŒã ãäœæããå¿
èŠãããããããããåæããã³ãŒãã¯ã©ãã§ãæ©èœããããšãä¿èšŒãããŸãã
ãã
ã§ãRMIã¹ã¿ãã®ããŒãçªå·ã®åé¡ã解決ããã³ãŒãïŒ
public static int getPort(RemoteStub stub) throws IOException { SObject sstub = (SObject) SerialScan.examine(stub); List<SEntity> writeObjectData = sstub.getAnnotations(); SBlockData sdata = (SBlockData) writeObjectData.get(0); DataInputStream din = sdata.getDataInputStream(); String type = din.readUTF(); if (type.equals("UnicastRef")) return getPortUnicastRef(din); else if (type.equals("UnicastRef2")) return getPortUnicastRef2(din); else throw new IOException("Can't handle ref type " + type); } private static int getPortUnicastRef(DataInputStream din) throws IOException { String host = din.readUTF(); return din.readInt(); } private static int getPortUnicastRef2(DataInputStream din) throws IOException { byte hasCSF = din.readByte(); String host = din.readUTF(); return din.readInt(); }
ãããç解ããã«ã¯ã
ã·ãªã¢ã«åãããRemoteObjectãã©ãŒã ã®èª¬æãèŠãŠãã ããã
ãã¡ããããã®ã³ãŒãã¯é£ããã§ããã移æ€ããã®ã¯ç°¡åã§ã䜿çšããããšãçŽæããŠããŸãã RMIã¹ã¿ãããä»ã®ãã¹ãŠã®ããŒã¿ãæœåºããæ¹æ³ã説æããããšã¯æå³ããªããšæããŸã-åãæ¹æ³ã䜿çšããŸãã
ãããã«
ã»ãšãã©ã®å Žåãæ·±å»ãªããŒãºããããŸã§ãã·ãªã¢ã«åããã圢åŒãæãäžããããªãã§ãããã ãããããããªãã§ã¯ã§ããªãå ŽåãSerialysisã¯ã¿ã¹ã¯ã倧å¹
ã«ç°¡çŽ åã§ããŸãã
ãŸããããã¯ãç¬èªã®ã¯ã©ã¹ãæåŸ
ã©ããã«ã·ãªã¢ã©ã€ãºãããŠããããšã確èªããããã®è¯ãæ¹æ³ã§ãã
Serialysisã©ã€ãã©ãªã¯ã
http ïŒ//weblogs.java.net/blog/emcmanus/serialysis.zipããããŠã³ããŒãã§ããŸãã