1 package org.oddjob.rmi; 2 3 import java.rmi.registry.LocateRegistry ; 4 import java.rmi.server.ExportException ; 5 6 import org.oddjob.framework.SimpleJob; 7 8 14 public class RMIRegistryJob extends SimpleJob { 15 16 17 public static final int DEFAULT_PORT = 1099; 18 19 24 private int port = DEFAULT_PORT; 25 26 31 synchronized public void setPort(int port) { 32 this.port = port; 33 } 34 35 40 synchronized public int getPort() { 41 return this.port; 42 } 43 44 48 public int execute() throws Exception { 49 try { 50 LocateRegistry.createRegistry(getPort()); 51 } catch (ExportException e) { 52 logger().debug("Registry probably created: " + e.getMessage()); 53 } 54 55 return 0; 56 } 57 } 58 | Popular Tags |