java.rmi.server.RemoteServer Java Examples
The following examples show how to use
java.rmi.server.RemoteServer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CheckLogging.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions() { SecurityException ex = null; try { // should fail for lack of LoggingPermission "control" RemoteServer.setLog(System.err); } catch (SecurityException e) { System.err.println("security excepton caught correctly"); ex = e; } if (ex == null) { TestLibrary.bomb("able to set log without permission"); } }
Example #2
Source File: CheckLogging.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions() { SecurityException ex = null; try { // should fail for lack of LoggingPermission "control" RemoteServer.setLog(System.err); } catch (SecurityException e) { System.err.println("security excepton caught correctly"); ex = e; } if (ex == null) { TestLibrary.bomb("able to set log without permission"); } }
Example #3
Source File: RMIServerImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static synchronized String makeConnectionId(String protocol, Subject subject) { connectionIdNumber++; String clientHost = ""; try { clientHost = RemoteServer.getClientHost(); /* * According to the rules specified in the javax.management.remote * package description, a numeric IPv6 address (detected by the * presence of otherwise forbidden ":" character) forming a part * of the connection id must be enclosed in square brackets. */ if (clientHost.contains(":")) { clientHost = "[" + clientHost + "]"; } } catch (ServerNotActiveException e) { logger.trace("makeConnectionId", "getClientHost", e); } final StringBuilder buf = new StringBuilder(); buf.append(protocol).append(":"); if (clientHost.length() > 0) buf.append("//").append(clientHost); buf.append(" "); if (subject != null) { Set<Principal> principals = subject.getPrincipals(); String sep = ""; for (Iterator<Principal> it = principals.iterator(); it.hasNext(); ) { Principal p = it.next(); String name = p.getName().replace(' ', '_').replace(';', ':'); buf.append(sep).append(name); sep = ";"; } } buf.append(" ").append(connectionIdNumber); if (logger.traceOn()) logger.trace("newConnectionId","connectionId="+buf); return buf.toString(); }
Example #4
Source File: CheckLogging.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions() { SecurityException ex = null; try { // should fail for lack of LoggingPermission "control" RemoteServer.setLog(System.err); } catch (SecurityException e) { System.err.println("security excepton caught correctly"); ex = e; } if (ex == null) { TestLibrary.bomb("able to set log without permission"); } }
Example #5
Source File: RMIServerImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static synchronized String makeConnectionId(String protocol, Subject subject) { connectionIdNumber++; String clientHost = ""; try { clientHost = RemoteServer.getClientHost(); /* * According to the rules specified in the javax.management.remote * package description, a numeric IPv6 address (detected by the * presence of otherwise forbidden ":" character) forming a part * of the connection id must be enclosed in square brackets. */ if (clientHost.contains(":")) { clientHost = "[" + clientHost + "]"; } } catch (ServerNotActiveException e) { logger.trace("makeConnectionId", "getClientHost", e); } final StringBuilder buf = new StringBuilder(); buf.append(protocol).append(":"); if (clientHost.length() > 0) buf.append("//").append(clientHost); buf.append(" "); if (subject != null) { Set<Principal> principals = subject.getPrincipals(); String sep = ""; for (Iterator<Principal> it = principals.iterator(); it.hasNext(); ) { Principal p = it.next(); String name = p.getName().replace(' ', '_').replace(';', ':'); buf.append(sep).append(name); sep = ";"; } } buf.append(" ").append(connectionIdNumber); if (logger.traceOn()) logger.trace("newConnectionId","connectionId="+buf); return buf.toString(); }
Example #6
Source File: CheckLogging.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions() { SecurityException ex = null; try { // should fail for lack of LoggingPermission "control" RemoteServer.setLog(System.err); } catch (SecurityException e) { System.err.println("security excepton caught correctly"); ex = e; } if (ex == null) { TestLibrary.bomb("able to set log without permission"); } }
Example #7
Source File: RMIServerImpl.java From Java8CN with Apache License 2.0 | 5 votes |
private static synchronized String makeConnectionId(String protocol, Subject subject) { connectionIdNumber++; String clientHost = ""; try { clientHost = RemoteServer.getClientHost(); /* * According to the rules specified in the javax.management.remote * package description, a numeric IPv6 address (detected by the * presence of otherwise forbidden ":" character) forming a part * of the connection id must be enclosed in square brackets. */ if (clientHost.contains(":")) { clientHost = "[" + clientHost + "]"; } } catch (ServerNotActiveException e) { logger.trace("makeConnectionId", "getClientHost", e); } final StringBuilder buf = new StringBuilder(); buf.append(protocol).append(":"); if (clientHost.length() > 0) buf.append("//").append(clientHost); buf.append(" "); if (subject != null) { Set<Principal> principals = subject.getPrincipals(); String sep = ""; for (Iterator<Principal> it = principals.iterator(); it.hasNext(); ) { Principal p = it.next(); String name = p.getName().replace(' ', '_').replace(';', ':'); buf.append(sep).append(name); sep = ";"; } } buf.append(" ").append(connectionIdNumber); if (logger.traceOn()) logger.trace("newConnectionId","connectionId="+buf); return buf.toString(); }
Example #8
Source File: RMIServerImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
private static synchronized String makeConnectionId(String protocol, Subject subject) { connectionIdNumber++; String clientHost = ""; try { clientHost = RemoteServer.getClientHost(); /* * According to the rules specified in the javax.management.remote * package description, a numeric IPv6 address (detected by the * presence of otherwise forbidden ":" character) forming a part * of the connection id must be enclosed in square brackets. */ if (clientHost.contains(":")) { clientHost = "[" + clientHost + "]"; } } catch (ServerNotActiveException e) { logger.trace("makeConnectionId", "getClientHost", e); } final StringBuilder buf = new StringBuilder(); buf.append(protocol).append(":"); if (clientHost.length() > 0) buf.append("//").append(clientHost); buf.append(" "); if (subject != null) { Set<Principal> principals = subject.getPrincipals(); String sep = ""; for (Iterator<Principal> it = principals.iterator(); it.hasNext(); ) { Principal p = it.next(); String name = p.getName().replace(' ', '_').replace(';', ':'); buf.append(sep).append(name); sep = ";"; } } buf.append(" ").append(connectionIdNumber); if (logger.traceOn()) logger.trace("newConnectionId","connectionId="+buf); return buf.toString(); }
Example #9
Source File: CheckLogging.java From hottub with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions() { SecurityException ex = null; try { // should fail for lack of LoggingPermission "control" RemoteServer.setLog(System.err); } catch (SecurityException e) { System.err.println("security excepton caught correctly"); ex = e; } if (ex == null) { TestLibrary.bomb("able to set log without permission"); } }
Example #10
Source File: RMIServerImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static synchronized String makeConnectionId(String protocol, Subject subject) { connectionIdNumber++; String clientHost = ""; try { clientHost = RemoteServer.getClientHost(); /* * According to the rules specified in the javax.management.remote * package description, a numeric IPv6 address (detected by the * presence of otherwise forbidden ":" character) forming a part * of the connection id must be enclosed in square brackets. */ if (clientHost.contains(":")) { clientHost = "[" + clientHost + "]"; } } catch (ServerNotActiveException e) { logger.trace("makeConnectionId", "getClientHost", e); } final StringBuilder buf = new StringBuilder(); buf.append(protocol).append(":"); if (clientHost.length() > 0) buf.append("//").append(clientHost); buf.append(" "); if (subject != null) { Set<Principal> principals = subject.getPrincipals(); String sep = ""; for (Iterator<Principal> it = principals.iterator(); it.hasNext(); ) { Principal p = it.next(); String name = p.getName().replace(' ', '_').replace(';', ':'); buf.append(sep).append(name); sep = ";"; } } buf.append(" ").append(connectionIdNumber); if (logger.traceOn()) logger.trace("newConnectionId","connectionId="+buf); return buf.toString(); }
Example #11
Source File: RMIServerImpl.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static synchronized String makeConnectionId(String protocol, Subject subject) { connectionIdNumber++; String clientHost = ""; try { clientHost = RemoteServer.getClientHost(); /* * According to the rules specified in the javax.management.remote * package description, a numeric IPv6 address (detected by the * presence of otherwise forbidden ":" character) forming a part * of the connection id must be enclosed in square brackets. */ if (clientHost.contains(":")) { clientHost = "[" + clientHost + "]"; } } catch (ServerNotActiveException e) { logger.trace("makeConnectionId", "getClientHost", e); } final StringBuilder buf = new StringBuilder(); buf.append(protocol).append(":"); if (clientHost.length() > 0) buf.append("//").append(clientHost); buf.append(" "); if (subject != null) { Set<Principal> principals = subject.getPrincipals(); String sep = ""; for (Iterator<Principal> it = principals.iterator(); it.hasNext(); ) { Principal p = it.next(); String name = p.getName().replace(' ', '_').replace(';', ':'); buf.append(sep).append(name); sep = ";"; } } buf.append(" ").append(connectionIdNumber); if (logger.traceOn()) logger.trace("newConnectionId","connectionId="+buf); return buf.toString(); }
Example #12
Source File: RMIServerImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static synchronized String makeConnectionId(String protocol, Subject subject) { connectionIdNumber++; String clientHost = ""; try { clientHost = RemoteServer.getClientHost(); /* * According to the rules specified in the javax.management.remote * package description, a numeric IPv6 address (detected by the * presence of otherwise forbidden ":" character) forming a part * of the connection id must be enclosed in square brackets. */ if (clientHost.contains(":")) { clientHost = "[" + clientHost + "]"; } } catch (ServerNotActiveException e) { logger.trace("makeConnectionId", "getClientHost", e); } final StringBuilder buf = new StringBuilder(); buf.append(protocol).append(":"); if (clientHost.length() > 0) buf.append("//").append(clientHost); buf.append(" "); if (subject != null) { Set<Principal> principals = subject.getPrincipals(); String sep = ""; for (Iterator<Principal> it = principals.iterator(); it.hasNext(); ) { Principal p = it.next(); String name = p.getName().replace(' ', '_').replace(';', ':'); buf.append(sep).append(name); sep = ";"; } } buf.append(" ").append(connectionIdNumber); if (logger.traceOn()) logger.trace("newConnectionId","connectionId="+buf); return buf.toString(); }
Example #13
Source File: CheckLogging.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions() { SecurityException ex = null; try { // should fail for lack of LoggingPermission "control" RemoteServer.setLog(System.err); } catch (SecurityException e) { System.err.println("security excepton caught correctly"); ex = e; } if (ex == null) { TestLibrary.bomb("able to set log without permission"); } }
Example #14
Source File: RMIServerImpl.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static synchronized String makeConnectionId(String protocol, Subject subject) { connectionIdNumber++; String clientHost = ""; try { clientHost = RemoteServer.getClientHost(); /* * According to the rules specified in the javax.management.remote * package description, a numeric IPv6 address (detected by the * presence of otherwise forbidden ":" character) forming a part * of the connection id must be enclosed in square brackets. */ if (clientHost.contains(":")) { clientHost = "[" + clientHost + "]"; } } catch (ServerNotActiveException e) { logger.trace("makeConnectionId", "getClientHost", e); } final StringBuilder buf = new StringBuilder(); buf.append(protocol).append(":"); if (clientHost.length() > 0) buf.append("//").append(clientHost); buf.append(" "); if (subject != null) { Set<Principal> principals = subject.getPrincipals(); String sep = ""; for (Iterator<Principal> it = principals.iterator(); it.hasNext(); ) { Principal p = it.next(); String name = p.getName().replace(' ', '_').replace(';', ':'); buf.append(sep).append(name); sep = ";"; } } buf.append(" ").append(connectionIdNumber); if (logger.traceOn()) logger.trace("newConnectionId","connectionId="+buf); return buf.toString(); }
Example #15
Source File: CheckLogging.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions() { SecurityException ex = null; try { // should fail for lack of LoggingPermission "control" RemoteServer.setLog(System.err); } catch (SecurityException e) { System.err.println("security excepton caught correctly"); ex = e; } if (ex == null) { TestLibrary.bomb("able to set log without permission"); } }
Example #16
Source File: RMIServerImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static synchronized String makeConnectionId(String protocol, Subject subject) { connectionIdNumber++; String clientHost = ""; try { clientHost = RemoteServer.getClientHost(); /* * According to the rules specified in the javax.management.remote * package description, a numeric IPv6 address (detected by the * presence of otherwise forbidden ":" character) forming a part * of the connection id must be enclosed in square brackets. */ if (clientHost.contains(":")) { clientHost = "[" + clientHost + "]"; } } catch (ServerNotActiveException e) { logger.trace("makeConnectionId", "getClientHost", e); } final StringBuilder buf = new StringBuilder(); buf.append(protocol).append(":"); if (clientHost.length() > 0) buf.append("//").append(clientHost); buf.append(" "); if (subject != null) { Set<Principal> principals = subject.getPrincipals(); String sep = ""; for (Iterator<Principal> it = principals.iterator(); it.hasNext(); ) { Principal p = it.next(); String name = p.getName().replace(' ', '_').replace(';', ':'); buf.append(sep).append(name); sep = ";"; } } buf.append(" ").append(connectionIdNumber); if (logger.traceOn()) logger.trace("newConnectionId","connectionId="+buf); return buf.toString(); }
Example #17
Source File: CheckLogging.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions() { SecurityException ex = null; try { // should fail for lack of LoggingPermission "control" RemoteServer.setLog(System.err); } catch (SecurityException e) { System.err.println("security excepton caught correctly"); ex = e; } if (ex == null) { TestLibrary.bomb("able to set log without permission"); } }
Example #18
Source File: RMIServerImpl.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private static synchronized String makeConnectionId(String protocol, Subject subject) { connectionIdNumber++; String clientHost = ""; try { clientHost = RemoteServer.getClientHost(); /* * According to the rules specified in the javax.management.remote * package description, a numeric IPv6 address (detected by the * presence of otherwise forbidden ":" character) forming a part * of the connection id must be enclosed in square brackets. */ if (clientHost.contains(":")) { clientHost = "[" + clientHost + "]"; } } catch (ServerNotActiveException e) { logger.trace("makeConnectionId", "getClientHost", e); } final StringBuilder buf = new StringBuilder(); buf.append(protocol).append(":"); if (clientHost.length() > 0) buf.append("//").append(clientHost); buf.append(" "); if (subject != null) { Set<Principal> principals = subject.getPrincipals(); String sep = ""; for (Iterator<Principal> it = principals.iterator(); it.hasNext(); ) { Principal p = it.next(); String name = p.getName().replace(' ', '_').replace(';', ':'); buf.append(sep).append(name); sep = ";"; } } buf.append(" ").append(connectionIdNumber); if (logger.traceOn()) logger.trace("newConnectionId","connectionId="+buf); return buf.toString(); }
Example #19
Source File: CheckLogging.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions() { SecurityException ex = null; try { // should fail for lack of LoggingPermission "control" RemoteServer.setLog(System.err); } catch (SecurityException e) { System.err.println("security excepton caught correctly"); ex = e; } if (ex == null) { TestLibrary.bomb("able to set log without permission"); } }
Example #20
Source File: MementoService.java From Fourinone with Apache License 2.0 | 5 votes |
String getClientHost(){ String clienthost=null; try{ clienthost = RemoteServer.getClientHost(); }catch(ServerNotActiveException ex){ LogUtil.fine("[MementoService]", "[getClientHost]", ex); } //System.out.println("clienthost:"+clienthost); return clienthost; }
Example #21
Source File: RMIServerImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static synchronized String makeConnectionId(String protocol, Subject subject) { connectionIdNumber++; String clientHost = ""; try { clientHost = RemoteServer.getClientHost(); /* * According to the rules specified in the javax.management.remote * package description, a numeric IPv6 address (detected by the * presence of otherwise forbidden ":" character) forming a part * of the connection id must be enclosed in square brackets. */ if (clientHost.contains(":")) { clientHost = "[" + clientHost + "]"; } } catch (ServerNotActiveException e) { logger.trace("makeConnectionId", "getClientHost", e); } final StringBuilder buf = new StringBuilder(); buf.append(protocol).append(":"); if (clientHost.length() > 0) buf.append("//").append(clientHost); buf.append(" "); if (subject != null) { Set<Principal> principals = subject.getPrincipals(); String sep = ""; for (Iterator<Principal> it = principals.iterator(); it.hasNext(); ) { Principal p = it.next(); String name = p.getName().replace(' ', '_').replace(';', ':'); buf.append(sep).append(name); sep = ";"; } } buf.append(" ").append(connectionIdNumber); if (logger.traceOn()) logger.trace("newConnectionId","connectionId="+buf); return buf.toString(); }
Example #22
Source File: CheckLogging.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions() { SecurityException ex = null; try { // should fail for lack of LoggingPermission "control" RemoteServer.setLog(System.err); } catch (SecurityException e) { System.err.println("security excepton caught correctly"); ex = e; } if (ex == null) { TestLibrary.bomb("able to set log without permission"); } }
Example #23
Source File: RMIServerImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static synchronized String makeConnectionId(String protocol, Subject subject) { connectionIdNumber++; String clientHost = ""; try { clientHost = RemoteServer.getClientHost(); /* * According to the rules specified in the javax.management.remote * package description, a numeric IPv6 address (detected by the * presence of otherwise forbidden ":" character) forming a part * of the connection id must be enclosed in square brackets. */ if (clientHost.contains(":")) { clientHost = "[" + clientHost + "]"; } } catch (ServerNotActiveException e) { logger.trace("makeConnectionId", "getClientHost", e); } final StringBuilder buf = new StringBuilder(); buf.append(protocol).append(":"); if (clientHost.length() > 0) buf.append("//").append(clientHost); buf.append(" "); if (subject != null) { Set<Principal> principals = subject.getPrincipals(); String sep = ""; for (Iterator<Principal> it = principals.iterator(); it.hasNext(); ) { Principal p = it.next(); String name = p.getName().replace(' ', '_').replace(';', ':'); buf.append(sep).append(name); sep = ";"; } } buf.append(" ").append(connectionIdNumber); if (logger.traceOn()) logger.trace("newConnectionId","connectionId="+buf); return buf.toString(); }
Example #24
Source File: CheckLogging.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions() { SecurityException ex = null; try { // should fail for lack of LoggingPermission "control" RemoteServer.setLog(System.err); } catch (SecurityException e) { System.err.println("security excepton caught correctly"); ex = e; } if (ex == null) { TestLibrary.bomb("able to set log without permission"); } }
Example #25
Source File: RMIServerImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static synchronized String makeConnectionId(String protocol, Subject subject) { connectionIdNumber++; String clientHost = ""; try { clientHost = RemoteServer.getClientHost(); /* * According to the rules specified in the javax.management.remote * package description, a numeric IPv6 address (detected by the * presence of otherwise forbidden ":" character) forming a part * of the connection id must be enclosed in square brackets. */ if (clientHost.contains(":")) { clientHost = "[" + clientHost + "]"; } } catch (ServerNotActiveException e) { logger.trace("makeConnectionId", "getClientHost", e); } final StringBuilder buf = new StringBuilder(); buf.append(protocol).append(":"); if (clientHost.length() > 0) buf.append("//").append(clientHost); buf.append(" "); if (subject != null) { Set<Principal> principals = subject.getPrincipals(); String sep = ""; for (Iterator<Principal> it = principals.iterator(); it.hasNext(); ) { Principal p = it.next(); String name = p.getName().replace(' ', '_').replace(';', ':'); buf.append(sep).append(name); sep = ";"; } } buf.append(" ").append(connectionIdNumber); if (logger.traceOn()) logger.trace("newConnectionId","connectionId="+buf); return buf.toString(); }
Example #26
Source File: RMIServerImpl.java From JDKSourceCode1.8 with MIT License | 5 votes |
private static synchronized String makeConnectionId(String protocol, Subject subject) { connectionIdNumber++; String clientHost = ""; try { clientHost = RemoteServer.getClientHost(); /* * According to the rules specified in the javax.management.remote * package description, a numeric IPv6 address (detected by the * presence of otherwise forbidden ":" character) forming a part * of the connection id must be enclosed in square brackets. */ if (clientHost.contains(":")) { clientHost = "[" + clientHost + "]"; } } catch (ServerNotActiveException e) { logger.trace("makeConnectionId", "getClientHost", e); } final StringBuilder buf = new StringBuilder(); buf.append(protocol).append(":"); if (clientHost.length() > 0) buf.append("//").append(clientHost); buf.append(" "); if (subject != null) { Set<Principal> principals = subject.getPrincipals(); String sep = ""; for (Iterator<Principal> it = principals.iterator(); it.hasNext(); ) { Principal p = it.next(); String name = p.getName().replace(' ', '_').replace(';', ':'); buf.append(sep).append(name); sep = ";"; } } buf.append(" ").append(connectionIdNumber); if (logger.traceOn()) logger.trace("newConnectionId","connectionId="+buf); return buf.toString(); }
Example #27
Source File: CheckLogging.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions() { SecurityException ex = null; try { // should fail for lack of LoggingPermission "control" RemoteServer.setLog(System.err); } catch (SecurityException e) { System.err.println("security excepton caught correctly"); ex = e; } if (ex == null) { TestLibrary.bomb("able to set log without permission"); } }
Example #28
Source File: CheckLogging.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions() { SecurityException ex = null; try { // should fail for lack of LoggingPermission "control" RemoteServer.setLog(System.err); } catch (SecurityException e) { System.err.println("security excepton caught correctly"); ex = e; } if (ex == null) { TestLibrary.bomb("able to set log without permission"); } }
Example #29
Source File: RMIServerImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static synchronized String makeConnectionId(String protocol, Subject subject) { connectionIdNumber++; String clientHost = ""; try { clientHost = RemoteServer.getClientHost(); /* * According to the rules specified in the javax.management.remote * package description, a numeric IPv6 address (detected by the * presence of otherwise forbidden ":" character) forming a part * of the connection id must be enclosed in square brackets. */ if (clientHost.contains(":")) { clientHost = "[" + clientHost + "]"; } } catch (ServerNotActiveException e) { logger.trace("makeConnectionId", "getClientHost", e); } final StringBuilder buf = new StringBuilder(); buf.append(protocol).append(":"); if (clientHost.length() > 0) buf.append("//").append(clientHost); buf.append(" "); if (subject != null) { Set<Principal> principals = subject.getPrincipals(); String sep = ""; for (Iterator<Principal> it = principals.iterator(); it.hasNext(); ) { Principal p = it.next(); String name = p.getName().replace(' ', '_').replace(';', ':'); buf.append(sep).append(name); sep = ";"; } } buf.append(" ").append(connectionIdNumber); if (logger.traceOn()) logger.trace("newConnectionId","connectionId="+buf); return buf.toString(); }
Example #30
Source File: RMIServerImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
private static synchronized String makeConnectionId(String protocol, Subject subject) { connectionIdNumber++; String clientHost = ""; try { clientHost = RemoteServer.getClientHost(); /* * According to the rules specified in the javax.management.remote * package description, a numeric IPv6 address (detected by the * presence of otherwise forbidden ":" character) forming a part * of the connection id must be enclosed in square brackets. */ if (clientHost.contains(":")) { clientHost = "[" + clientHost + "]"; } } catch (ServerNotActiveException e) { logger.trace("makeConnectionId", "getClientHost", e); } final StringBuilder buf = new StringBuilder(); buf.append(protocol).append(":"); if (clientHost.length() > 0) buf.append("//").append(clientHost); buf.append(" "); if (subject != null) { Set<Principal> principals = subject.getPrincipals(); String sep = ""; for (Iterator<Principal> it = principals.iterator(); it.hasNext(); ) { Principal p = it.next(); String name = p.getName().replace(' ', '_').replace(';', ':'); buf.append(sep).append(name); sep = ";"; } } buf.append(" ").append(connectionIdNumber); if (logger.traceOn()) logger.trace("newConnectionId","connectionId="+buf); return buf.toString(); }