当前位置: 首页>>代码示例>>Java>>正文


Java SocketUtil类代码示例

本文整理汇总了Java中org.eclipse.jdt.launching.SocketUtil的典型用法代码示例。如果您正苦于以下问题:Java SocketUtil类的具体用法?Java SocketUtil怎么用?Java SocketUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SocketUtil类属于org.eclipse.jdt.launching包,在下文中一共展示了SocketUtil类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureJMXConnector

import org.eclipse.jdt.launching.SocketUtil; //导入依赖的package包/类
private void configureJMXConnector(
        final KarafWorkingPlatformModel platformModel) throws CoreException {
    /*
     * Ensure that the RMI registry port for the JMX connector is unique
     */
    final int jmxRegistryPort = SocketUtil.findFreePort();

    if (jmxRegistryPort == -1) {
        throw new CoreException(new Status(
                IStatus.ERROR,
                KarafUIPluginActivator.PLUGIN_ID,
                "Could not find suitable TCP/IP port for JMX RMI Registry"));
    }

    final ManagementSection managementSection =
            (ManagementSection) platformModel.getAdapter(ManagementSection.class);

    managementSection.load();
    managementSection.setPort(jmxRegistryPort);
    managementSection.save();
}
 
开发者ID:apache,项目名称:karaf-eik,代码行数:22,代码来源:GenericKarafWorkbenchService.java

示例2: getDebugPort

import org.eclipse.jdt.launching.SocketUtil; //导入依赖的package包/类
private int getDebugPort() throws CoreException {
  int port = SocketUtil.findFreePort();
  if (port == -1) {
    abort("Cannot find free port for remote debugger", null, IStatus.ERROR); //$NON-NLS-1$
  }
  return port;
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:8,代码来源:LocalAppEngineServerLaunchConfigurationDelegate.java

示例3: startJetty

import org.eclipse.jdt.launching.SocketUtil; //导入依赖的package包/类
public static void startJetty(IProject project, JasperReportsConfiguration jContext) {
	try {
		if (server == null) {
			Integer p = jContext.getPropertyInteger(GlobalPreferencePage.JSS_JETTY_PORT);
			if (p == null || p.intValue() <= 0)
				port = SocketUtil.findFreePort();
			else
				port = p;

			if (port == -1)
				port = 8888;
			server = new Server(port);
			HandlerCollection hc = new HandlerCollection();
			contextHandlerCollection = new ContextHandlerCollection();
			hc.setHandlers(new Handler[] { contextHandlerCollection });
			server.setHandler(hc);

			server.start();

		}
		if (hmap.get(project) == null) {

			// server.stop();

			List<Handler> handlers = createContext(project, jContext);
			hmap.put(project, handlers);
			for (Handler h : handlers) {
				contextHandlerCollection.addHandler(h);
				h.start();
			}
		}
	} catch (Exception e) {
		throw new JRRuntimeException(e);
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:36,代码来源:JettyUtil.java

示例4: setUp

import org.eclipse.jdt.launching.SocketUtil; //导入依赖的package包/类
@Before
public void setUp() {
	port = SocketUtil.findFreePort();
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:5,代码来源:MultipleConnectionsTest.java


注:本文中的org.eclipse.jdt.launching.SocketUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。