View
24
Download
0
Category
Preview:
DESCRIPTION
제 1 회 한국 자바 개발자 컨퍼런스. Jini Technology. 발표자 : 강신동 Email : sindong2@chollian.net 강신동 @idosi.com Mobile : 016-201-5053 소속 : ㈜ idosi.com 대표이사 주최 : JavaCommunity.Org 발표일자 : 2000 년 4 월 9 일. 목 차. 1. Jini 개요 2. Jini site 와 개발도구 3. bytecode 이동과 instance 이동 4. Discovery 5. Join - PowerPoint PPT Presentation
Citation preview
Jini Technology
제 1 회 한국 자바 개발자 컨퍼런스
발표자 : 강신동Email : sindong2@chollian.net 강신동 @idosi.comMobile : 016-201-5053소속 : ㈜ idosi.com 대표이사주최 : JavaCommunity.Org발표일자 : 2000 년 4 월 9 일
목 차
1. Jini 개요2. Jini site 와 개발도구3. bytecode 이동과 instance 이동4. Discovery5. Join6. Lookup7. Lookup reservation8. Lease9. Using back-end process10. RMI diagram11. Jini diagram
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
Jini site 와 개발도구
JDK 1.2 (Java 2) 이상rmid : lookup daemon
Jini Technology Starter Kit (jini1.1 alpha) reggie : sun’s lookup servicehttpd
web server for downloading rmi’s stub class
Lookup service 이용을 위한 기본도구
Jini web sitehttp://java.sun.com/jinihttp://www.jini.orghttp://artima.com/jinihttp://jiniworld.chonnam.ac.kr
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
bytecode 이동과 instance 이동
bytecode 의 network 이동
instance 의 network 이동
Ex) appletclient 중심개념실행코드가 run-time 상태의 client JVM 으로 이동모든 instance 는 client 의 JVM 에서 생성된다
Ex) Jiniservice 중심개념interface 이용실행코드와 data 의 run-time 시 이동service 에서 만들어진 instance 가 동적으로 client 의
JVM 에서 즉시 이용될 수 있는 특징network 에서 이동된 instance 는 client 에서 만들어진 instance 처럼 이용
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
Discovery
Lookup-service
ServiceClient
Service 는 자신을 등록하기 위해 network 상에서 Lookup service 를 찾는다 .
Client 는 등록된 Service 를 찾기 위해 network 상에서 Lookup service 를 찾는다 .
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
Discovery protocol
Lookup ServiceDiscoverer
Request messageUDP multicast
Response messageTCP unicast
Multicast request protocol
Lookup ServiceDiscoverer
Request messageTCP unicast
Response messageTCP unicast
Multicast announcement protocol
Announcement messageUDP multicast
Request messageTCP unicast
Response messageTCP unicast
Unicast discovery protocol강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
Discovery (receive ServiceRegistrar)
Lookup-service
Service
Client
ServiceRegistrar
ServiceRegistrar
Service JVM
Client JVM
Lookup JVM
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
Discovery (code)
UnicastDiscovery
MulticastDiscovery
Lookup-service 의 위치를 알고있는 경우TCP/IP Socket 이용 직접 접속 (port 4160)synchronous processingLookupLocator lookup = new LookupLocator(“jini://jini.idosi.com”); ServiceRegistrar registrar = lookup.getRegistrar();
Lookup-service 의 위치를 모르는 경우Multicast 이용 lookup-service 응답기다림service 에서 cient 로 TCP/IP Socket 이용연결asynchronous processingLookupDiscovery discover = new LookupDiscovery(LookupDiscovery.ALL_GROUPS);discovery.addDiscoveryListener(listener);public void discovered(DiscoveryEvent evt){ ServiceRegistrar[] registrars = evt.getRegistrars();}
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
Join (service copy)
Service
Service Copy
Service Proxy
ServiceRegistrar
ServiceItem
ServiceItem
Service JVM
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
Join (regist service proxy)
Lookup-service
Service
Service Copy
Service Proxy registerServiceRegistrar
Service JVM
Lookup JVM
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
Join (code)
ServiceRegistrar registrar = …;ServiceID id = null; // 전세계에서 유일한 id 부여 Entry entry = null; // service 의 부가정보제공MyServiceInterface proxy = createServiceInterfaceInstance();ServiceItem item = new ServiceItem(id, proxy, entry);long leaseTime = 1 * 60 * 1000; // msecServiceRegistration registration = registrar.register(item, leaseTime);
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
Lookup (receive service copy)
Lookup-service
Lookup JVMClient
ServiceTemplate
Service copy
Client JVM
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
Lookup (code)
ServiceRegistrar registrar = …;ServiceID id = null; // 전세계에서 유일한 id 부여 Entry entry = null; // service 의 부가정보제공Class[] types = { MyServiceInterface.class };ServiceTemplate template = new ServiceTemplate(id, types, entry);Object o = registrar.lookup(template);if (o instanceof MyServiceInterface){ MyServiceInterface service = (MyServiceInterface) o; Object result = service.callMyMethod();}
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
Lookup Reservation
Client
ServiceTemplate
Client JVM
RemoteEventListener
Lookup-service
Lookup JVM
notify
notifyServiceEvent
ServiceItem Service Copy
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
Lookup Reservation (code)
ServiceRegistrar registrar = …..;Entry entry = null;long leaseTime = 1 * 60 * 1000;EventRegistration evtreg = registrar.notify(template, ServiceRegistrar.TRANSITION_NOMATCH_MATCH, myRemoteEventListener, entry, leaseTime);MyRemoteEventListener extends UnicastRemoteObject implements RemoteEventListenerpublic void notify(RemoteEvent evt) throws RemoteException, UnknownEventException{ if (evt instanceof ServiceEvent) { ServiceEvent sevt = (ServiceEvent) evt; ServiceItem item = sevt.getServiceItem(); MyServiceInterface service = (MyServiceInterface) item.service; Object result = service.callMyMethod(); }}
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
Lookup federation topology
Community of communities
Hierarchies Stars Island
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
Lease (service side)
Lookup-service
Service
register
ServiceRegistrar
Service JVM Lookup JVM
ServiceRegistration
Leaserenew()
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
Lease (service code)
ServiceRegistration registration = registrar.register(…….);public void run() { while (true) { try { Lease lease = registration.getLease(); long expiration = lease.getExpiration(); long sleepTime = computeSleepTime(); Thread.sleep(sleeptime); lease.renew( 1 * 60 * 1000); } } }
Lease expiration
time linenownow
renew zone
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
Lease (client side)
Lookup-service
notifyServiceRegistrar
Client JVM Lookup JVM
EventRegistration
Leaserenew()
Client
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
Lease (client code)
ServiceRegistration servreg = registrar.register(……);Lease lease = servreg.getLease();long expiration = lease.getExpiration();if ( RENEW_ZONE){ lease.renew(LEASE_TIME);}
EventRegistration evtreg = registrar.notify(……);Lease lease = evtreg.getLease();long expiration = lease.getExpiration();if ( RENEW_ZONE){ lease.renew(LEASE_TIME);}
service renew lease
client renew lease
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
Using Back-end Process
Lookup-service
Lookup JVM
Service
Service ProxyRemote Server
Client
RMI, Socket ...
Service JVM Client JVM
choke point
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
RMI diagram
RemoteInterface
RemoteImpl
UnicastRemoteObject
Skeleton Stub RemoteInterface
rmiregistry
webserver
client
Server JVMClient JVM
bind
lookup
rmi
stubcode
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
Jini diagram (service copy)
MyInterface
Serializable
MyService
rmid (reggie)
register
MyInterface
client
lookup
MyService
Web server
MyInterface
Service JVM
Client JVM
강신동 (sindong2@chollian.ne,t , 강신동 @idosi.com)
Recommended