java - Exporting remote data and Socket Reuse in RMI -


i new rmi please forgive me if question silly. trying export data in concurrent manner. how can reuse same port exporting more 1 remote object @ once. can guide me achieve example?

i tried first object got exported got following exception @ time of second export.

java.rmi.server.exportexception: port in use: 55580; nested exception is: java.net.bindexception: address in use: jvm_bind

i used following code snippet

unicastremoteobject.exportobject(remoteobj, 55580);

if skipped port number port number picked rmi. below

unicastremoteobject.exportobject(remoteobj)

in case port number fixed application.

how can reuse same port exporting more 1 remote object @ once

that's happens default. remote objects exported same jvm that

  • don't specify port number, or specify port zero, and
  • don't specify server or client socket factories, or specify same socket factories determined equals()

will exported on same port.

i conclude must exporting remote objects 2 jvms. there's no real need that. put them one. if start registry in there well, locateregistry.createregistry(), can use registry port 1099 everything, , it's reserved @ iana, no arguments number.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -