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


Java VertxInternal类代码示例

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


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

示例1: createContext

import org.vertx.java.core.impl.VertxInternal; //导入依赖的package包/类
public SSLContext createContext(VertxInternal vertx,
        final String ksPath,
        final String ksPassword,
        final String tsPath,
        final String tsPassword,
        final boolean trustAll) {
    if (externalSSLContext != null) {
        return externalSSLContext;
    }
    try {
        SSLContext context = SSLContext.getInstance("TLS");
        KeyManager[] keyMgrs = ksPath == null ? null : getKeyMgrs(vertx, ksPath, ksPassword);
        TrustManager[] trustMgrs;
        if (trustAll) {
            trustMgrs = new TrustManager[]{createTrustAllTrustManager()};
        } else {
            trustMgrs = tsPath == null ? null : getTrustMgrs(vertx, tsPath, tsPassword);
        }
        context.init(keyMgrs, trustMgrs, new SecureRandom());
        return context;
    } catch (Exception e) {
        //TODO better logging
        log.error("Failed to create context", e);
        throw new RuntimeException(e.getMessage());
    }
}
 
开发者ID:clidev,项目名称:spike.x,代码行数:27,代码来源:TCPSSLHelper.java

示例2: loadStore

import org.vertx.java.core.impl.VertxInternal; //导入依赖的package包/类
private static KeyStore loadStore(VertxInternal vertx, String path, final String ksPassword) throws Exception {
    final String ksPath = PathAdjuster.adjust(vertx, path);
    KeyStore ks = KeyStore.getInstance("JKS");
    InputStream in = null;
    try {
        in = new FileInputStream(new File(ksPath));
        ks.load(in, ksPassword != null ? ksPassword.toCharArray() : null);
    } finally {
        if (in != null) {
            try {
                in.close();
            } catch (IOException ignore) {
            }
        }
    }
    return ks;
}
 
开发者ID:clidev,项目名称:spike.x,代码行数:18,代码来源:TCPSSLHelper.java

示例3: getHazelcastInstance

import org.vertx.java.core.impl.VertxInternal; //导入依赖的package包/类
/**
 * Returns the Vert.x Hazelcast instance if one exists.
 *
 * @param vertx The current Vert.x instance.
 * @return The Vert.x Hazelcast instance if Vert.x is clustered.
 */
static HazelcastInstance getHazelcastInstance(Vertx vertx) {
  VertxInternal vertxInternal = (VertxInternal) vertx;
  ClusterManager clusterManager = vertxInternal.clusterManager();
  if (clusterManager != null) {
    Class<?> clazz = clusterManager.getClass();
    Field field;
    try {
      field = clazz.getDeclaredField("hazelcast");
      field.setAccessible(true);
      return HazelcastInstance.class.cast(field.get(clusterManager));
    } catch (Exception e) {
      return null;
    }
  }
  return null;
}
 
开发者ID:kuujo,项目名称:vertigo,代码行数:23,代码来源:ClusterListenerFactory.java

示例4: start

import org.vertx.java.core.impl.VertxInternal; //导入依赖的package包/类
@Override
public void start(final Future<Void> startedResult) {
  super.start();
  final CountingCompletionHandler<Void> countDownLatch =
      new CountingCompletionHandler<Void>((VertxInternal) vertx);
  countDownLatch.setHandler(new Handler<AsyncResult<Void>>() {
    @Override
    public void handle(AsyncResult<Void> ar) {
      if (ar.failed()) {
        startedResult.setFailure(ar.cause());
      } else if (ar.succeeded()) {
        startedResult.setResult(null);
      }
    }
  });
  new ChannelBridge(vertx, config).setHook(new BridgeHook(vertx)).bridge(countDownLatch);
}
 
开发者ID:goodow,项目名称:realtime-channel,代码行数:18,代码来源:ChannelVerticle.java

示例5: getTrustMgrs

import org.vertx.java.core.impl.VertxInternal; //导入依赖的package包/类
private static TrustManager[] getTrustMgrs(VertxInternal vertx, final String tsPath,
        final String tsPassword) throws Exception {
    TrustManagerFactory fact = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
    KeyStore ts = loadStore(vertx, tsPath, tsPassword);
    fact.init(ts);
    return fact.getTrustManagers();
}
 
开发者ID:clidev,项目名称:spike.x,代码行数:8,代码来源:TCPSSLHelper.java

示例6: init

import org.vertx.java.core.impl.VertxInternal; //导入依赖的package包/类
@Override
public void init(Vertx vertx, final Container container, RouteMatcher rm,
		Map<String, fr.wseduc.webutils.security.SecuredAction> securedActions) {
	super.init(vertx, container, rm, securedActions);

	ConcurrentSharedMap<Object, Object> server = vertx.sharedData().getMap("server");
	Boolean cluster = (Boolean) server.get("cluster");
	if (Boolean.TRUE.equals(cluster)) {
		ClusterManager cm = ((VertxInternal) vertx).clusterManager();
		cursusMap = cm.getSyncMap("cursusMap");
	} else {
		cursusMap = new HashMap<>();
	}

	/*
	service.refreshToken(new Handler<Boolean>() {
		public void handle(Boolean res) {
			if(!res)
				log.error("[Cursus][refreshToken] Error while retrieving the Token.");
			else
				log.info("[Cursus][refreshToken] Token refreshed.");
		}
	});
	*/
	if(cursusMap.containsKey("wallets"))
		return;
	service.refreshWallets(new Handler<Boolean>() {
		public void handle(Boolean res) {
			if(!res)
				log.error("[Cursus][refreshWallets] Error while retrieving the wallets list.");
			else
				log.info("[Cursus][refreshWallets] Wallets list refreshed.");
		}
	});

}
 
开发者ID:OPEN-ENT-NG,项目名称:cursus,代码行数:37,代码来源:CursusController.java

示例7: testSendingStringJsonWithResponseJson

import org.vertx.java.core.impl.VertxInternal; //导入依赖的package包/类
@Test
public void testSendingStringJsonWithResponseJson() throws IOException {
	final EventBusMessageType messageType = EventBusMessageType.String;
	final String sentString = new String("HelloWorld");
	int port = findFreePort();
	String responseUrl = createHttpServerUrl(port);
	Map<String, String> expectations = createExpectations("someaddress", Base64.encodeAsString(sentString), messageType, responseUrl, MediaType.APPLICATION_JSON);
	String responseBody = TemplateHelper.generateOutputUsingTemplate(SEND_RESPONSE_TEMPLATE_JSON, expectations);
	createHttpServer(port, MediaType.APPLICATION_JSON, responseBody);
	Handler<Message> messageConsumerHandler = new MessageSendWithReplyHandler(sentString, expectations);
	vertx.eventBus().registerHandler(expectations.get("address"), messageConsumerHandler);
	String requestBody = TemplateHelper.generateOutputUsingTemplate(SEND_REQUEST_TEMPLATE_JSON, expectations);
	HttpRequestHelper.sendHttpPostRequest(url, requestBody, (VertxInternal) vertx, Status.ACCEPTED.getStatusCode(), MediaType.APPLICATION_JSON);
}
 
开发者ID:j2ro,项目名称:mod-http-event-bus-bridge,代码行数:15,代码来源:MessageSendWithReplyTest.java

示例8: testSendingBooleanJsonWithResponseJson

import org.vertx.java.core.impl.VertxInternal; //导入依赖的package包/类
@Test
public void testSendingBooleanJsonWithResponseJson() throws IOException {
	final EventBusMessageType messageType = EventBusMessageType.Boolean;
	final Boolean sentBoolean = Boolean.TRUE;
	int port = findFreePort();
	String responseUrl = createHttpServerUrl(port);
	Map<String, String> expectations = createExpectations("someaddress", Base64.encodeAsString(sentBoolean.toString()), messageType, responseUrl, MediaType.APPLICATION_JSON);
	String responseBody = TemplateHelper.generateOutputUsingTemplate(SEND_RESPONSE_TEMPLATE_JSON, expectations);
	createHttpServer(port, MediaType.APPLICATION_JSON, responseBody);
	Handler<Message> messageConsumerHandler = new MessageSendWithReplyHandler(sentBoolean, expectations);
	vertx.eventBus().registerHandler(expectations.get("address"), messageConsumerHandler);
	String requestBody = TemplateHelper.generateOutputUsingTemplate(SEND_REQUEST_TEMPLATE_JSON, expectations);
	HttpRequestHelper.sendHttpPostRequest(url, requestBody, (VertxInternal) vertx, Status.ACCEPTED.getStatusCode(), MediaType.APPLICATION_JSON);
}
 
开发者ID:j2ro,项目名称:mod-http-event-bus-bridge,代码行数:15,代码来源:MessageSendWithReplyTest.java

示例9: testSendingByteJsonWithResponseJson

import org.vertx.java.core.impl.VertxInternal; //导入依赖的package包/类
@Test
public void testSendingByteJsonWithResponseJson() throws IOException {
	final EventBusMessageType messageType = EventBusMessageType.Byte;
	final Byte sentByte = Byte.MAX_VALUE;
	int port = findFreePort();
	String responseUrl = createHttpServerUrl(port);
	Map<String, String> expectations = createExpectations("someaddress", Base64.encodeAsString(sentByte.toString()), messageType, responseUrl, MediaType.APPLICATION_JSON);
	String responseBody = TemplateHelper.generateOutputUsingTemplate(SEND_RESPONSE_TEMPLATE_JSON, expectations);
	createHttpServer(port, MediaType.APPLICATION_JSON, responseBody);
	Handler<Message> messageConsumerHandler = new MessageSendWithReplyHandler(sentByte, expectations);
	vertx.eventBus().registerHandler(expectations.get("address"), messageConsumerHandler);
	String requestBody = TemplateHelper.generateOutputUsingTemplate(SEND_REQUEST_TEMPLATE_JSON, expectations);
	HttpRequestHelper.sendHttpPostRequest(url, requestBody, (VertxInternal) vertx, Status.ACCEPTED.getStatusCode(), MediaType.APPLICATION_JSON);
}
 
开发者ID:j2ro,项目名称:mod-http-event-bus-bridge,代码行数:15,代码来源:MessageSendWithReplyTest.java

示例10: testSendingByteArrayJsonWithResponseJson

import org.vertx.java.core.impl.VertxInternal; //导入依赖的package包/类
@Test
public void testSendingByteArrayJsonWithResponseJson() throws IOException {
	final EventBusMessageType messageType = EventBusMessageType.ByteArray;
	final byte[] sentByteArray = new byte[] {0, 1, 2, 3, 4, 5, 6, 7};
	int port = findFreePort();
	String responseUrl = createHttpServerUrl(port);
	Map<String, String> expectations = createExpectations("someaddress", Base64.encodeAsString(sentByteArray), messageType, responseUrl, MediaType.APPLICATION_JSON);
	String responseBody = TemplateHelper.generateOutputUsingTemplate(SEND_RESPONSE_TEMPLATE_JSON, expectations);
	createHttpServer(port, MediaType.APPLICATION_JSON, responseBody);
	Handler<Message> messageConsumerHandler = new MessageSendWithReplyHandler(sentByteArray, expectations);
	vertx.eventBus().registerHandler(expectations.get("address"), messageConsumerHandler);
	String requestBody = TemplateHelper.generateOutputUsingTemplate(SEND_REQUEST_TEMPLATE_JSON, expectations);
	HttpRequestHelper.sendHttpPostRequest(url, requestBody, (VertxInternal) vertx, Status.ACCEPTED.getStatusCode(), MediaType.APPLICATION_JSON);
}
 
开发者ID:j2ro,项目名称:mod-http-event-bus-bridge,代码行数:15,代码来源:MessageSendWithReplyTest.java

示例11: testSendingCharacterJsonWithResponseJson

import org.vertx.java.core.impl.VertxInternal; //导入依赖的package包/类
@Test
public void testSendingCharacterJsonWithResponseJson() throws IOException {
	final EventBusMessageType messageType = EventBusMessageType.Character;
	final Character sentCharacter = new Character('T');
	int port = findFreePort();
	String responseUrl = createHttpServerUrl(port);
	Map<String, String> expectations = createExpectations("someaddress", Base64.encodeAsString(sentCharacter.toString()), messageType, responseUrl, MediaType.APPLICATION_JSON);
	String responseBody = TemplateHelper.generateOutputUsingTemplate(SEND_RESPONSE_TEMPLATE_JSON, expectations);
	createHttpServer(port, MediaType.APPLICATION_JSON, responseBody);
	Handler<Message> messageConsumerHandler = new MessageSendWithReplyHandler(sentCharacter, expectations);
	vertx.eventBus().registerHandler(expectations.get("address"), messageConsumerHandler);
	String requestBody = TemplateHelper.generateOutputUsingTemplate(SEND_REQUEST_TEMPLATE_JSON, expectations);
	HttpRequestHelper.sendHttpPostRequest(url, requestBody, (VertxInternal) vertx, Status.ACCEPTED.getStatusCode(), MediaType.APPLICATION_JSON);
}
 
开发者ID:j2ro,项目名称:mod-http-event-bus-bridge,代码行数:15,代码来源:MessageSendWithReplyTest.java

示例12: testSendingDoubleJsonWithResponseJson

import org.vertx.java.core.impl.VertxInternal; //导入依赖的package包/类
@Test
public void testSendingDoubleJsonWithResponseJson() throws IOException {
	final EventBusMessageType messageType = EventBusMessageType.Double;
	final Double sentDouble = Double.MAX_VALUE;
	int port = findFreePort();
	String responseUrl = createHttpServerUrl(port);
	Map<String, String> expectations = createExpectations("someaddress", Base64.encodeAsString(sentDouble.toString()), messageType, responseUrl, MediaType.APPLICATION_JSON);
	String responseBody = TemplateHelper.generateOutputUsingTemplate(SEND_RESPONSE_TEMPLATE_JSON, expectations);
	createHttpServer(port, MediaType.APPLICATION_JSON, responseBody);
	Handler<Message> messageConsumerHandler = new MessageSendWithReplyHandler(sentDouble, expectations);
	vertx.eventBus().registerHandler(expectations.get("address"), messageConsumerHandler);
	String requestBody = TemplateHelper.generateOutputUsingTemplate(SEND_REQUEST_TEMPLATE_JSON, expectations);
	HttpRequestHelper.sendHttpPostRequest(url, requestBody, (VertxInternal) vertx, Status.ACCEPTED.getStatusCode(), MediaType.APPLICATION_JSON);
}
 
开发者ID:j2ro,项目名称:mod-http-event-bus-bridge,代码行数:15,代码来源:MessageSendWithReplyTest.java

示例13: testSendingFloatJsonWithResponseJson

import org.vertx.java.core.impl.VertxInternal; //导入依赖的package包/类
@Test
public void testSendingFloatJsonWithResponseJson() throws IOException {
	final EventBusMessageType messageType = EventBusMessageType.Float;
	final Float sentFloat = Float.MAX_VALUE;
	int port = findFreePort();
	String responseUrl = createHttpServerUrl(port);
	Map<String, String> expectations = createExpectations("someaddress", Base64.encodeAsString(sentFloat.toString()), messageType, responseUrl, MediaType.APPLICATION_JSON);
	String responseBody = TemplateHelper.generateOutputUsingTemplate(SEND_RESPONSE_TEMPLATE_JSON, expectations);
	createHttpServer(port, MediaType.APPLICATION_JSON, responseBody);
	Handler<Message> messageConsumerHandler = new MessageSendWithReplyHandler(sentFloat, expectations);
	vertx.eventBus().registerHandler(expectations.get("address"), messageConsumerHandler);
	String requestBody = TemplateHelper.generateOutputUsingTemplate(SEND_REQUEST_TEMPLATE_JSON, expectations);
	HttpRequestHelper.sendHttpPostRequest(url, requestBody, (VertxInternal) vertx, Status.ACCEPTED.getStatusCode(), MediaType.APPLICATION_JSON);
}
 
开发者ID:j2ro,项目名称:mod-http-event-bus-bridge,代码行数:15,代码来源:MessageSendWithReplyTest.java

示例14: testSendingIntegerJsonWithResponseJson

import org.vertx.java.core.impl.VertxInternal; //导入依赖的package包/类
@Test
public void testSendingIntegerJsonWithResponseJson() throws IOException {
	final EventBusMessageType messageType = EventBusMessageType.Integer;
	final Integer sentInteger = Integer.MAX_VALUE;
	int port = findFreePort();
	String responseUrl = createHttpServerUrl(port);
	Map<String, String> expectations = createExpectations("someaddress", Base64.encodeAsString(sentInteger.toString()), messageType, responseUrl, MediaType.APPLICATION_JSON);
	String responseBody = TemplateHelper.generateOutputUsingTemplate(SEND_RESPONSE_TEMPLATE_JSON, expectations);
	createHttpServer(port, MediaType.APPLICATION_JSON, responseBody);
	Handler<Message> messageConsumerHandler = new MessageSendWithReplyHandler(sentInteger, expectations);
	vertx.eventBus().registerHandler(expectations.get("address"), messageConsumerHandler);
	String requestBody = TemplateHelper.generateOutputUsingTemplate(SEND_REQUEST_TEMPLATE_JSON, expectations);
	HttpRequestHelper.sendHttpPostRequest(url, requestBody, (VertxInternal) vertx, Status.ACCEPTED.getStatusCode(), MediaType.APPLICATION_JSON);
}
 
开发者ID:j2ro,项目名称:mod-http-event-bus-bridge,代码行数:15,代码来源:MessageSendWithReplyTest.java

示例15: testSendingJsonArrayJsonWithResponseJson

import org.vertx.java.core.impl.VertxInternal; //导入依赖的package包/类
@Test
public void testSendingJsonArrayJsonWithResponseJson() throws IOException {
	final EventBusMessageType messageType = EventBusMessageType.JsonArray;
	final JsonArray sentJsonArray = new JsonArray("[\"TestString\",2147483647,true]");
	int port = findFreePort();
	String responseUrl = createHttpServerUrl(port);
	Map<String, String> expectations = createExpectations("someaddress", Base64.encodeAsString(sentJsonArray.toString()), messageType, responseUrl, MediaType.APPLICATION_JSON);
	String responseBody = TemplateHelper.generateOutputUsingTemplate(SEND_RESPONSE_TEMPLATE_JSON, expectations);
	createHttpServer(port, MediaType.APPLICATION_JSON, responseBody);
	Handler<Message> messageConsumerHandler = new MessageSendWithReplyHandler(sentJsonArray, expectations);
	vertx.eventBus().registerHandler(expectations.get("address"), messageConsumerHandler);
	String requestBody = TemplateHelper.generateOutputUsingTemplate(SEND_REQUEST_TEMPLATE_JSON, expectations);
	HttpRequestHelper.sendHttpPostRequest(url, requestBody, (VertxInternal) vertx, Status.ACCEPTED.getStatusCode(), MediaType.APPLICATION_JSON);
}
 
开发者ID:j2ro,项目名称:mod-http-event-bus-bridge,代码行数:15,代码来源:MessageSendWithReplyTest.java


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