當前位置: 首頁>>代碼示例>>Java>>正文


Java Routing類代碼示例

本文整理匯總了Java中org.openspaces.remoting.Routing的典型用法代碼示例。如果您正苦於以下問題:Java Routing類的具體用法?Java Routing怎麽用?Java Routing使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Routing類屬於org.openspaces.remoting包,在下文中一共展示了Routing類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: lookForRoutingAnnotationInMethodSignature

import org.openspaces.remoting.Routing; //導入依賴的package包/類
public static Router lookForRoutingAnnotationInMethodSignature(Method m) {
	Router routingStrategy = null;
	for (int argumentIndex = 0; argumentIndex < m.getParameterTypes().length; argumentIndex++) {
		for (Annotation a : m.getParameterAnnotations()[argumentIndex]) {
			if (a.annotationType().equals(Routing.class)) {
				if (routingStrategy != null) {
					throw new AmbiguousRoutingException(String.format("Ambiguous routing, multiple @Routing annotated methods on %s", m.toString()));
				}
				routingStrategy = createRoutingStrategy(m, argumentIndex, (Routing) a);
			}
		}
	}
	return routingStrategy;
}
 
開發者ID:AvanzaBank,項目名稱:astrix,代碼行數:15,代碼來源:GsRoutingStrategy.java

示例2: createRoutingStrategy

import org.openspaces.remoting.Routing; //導入依賴的package包/類
public static Router createRoutingStrategy(Method serviceMethod, int routingArgumentIndex, Routing routingAnnotation) {
	if (routingAnnotation.value().trim().isEmpty()) {
		return new AnnotatedArgumentRouter(routingArgumentIndex);
	} 
	String targetRoutingMethod = routingAnnotation.value();
	try {
		Class<?> type = serviceMethod.getParameterTypes()[routingArgumentIndex];
		Method method = type.getMethod(targetRoutingMethod);
		return new PropertyOnAnnotatedArgumentRoutingStrategy(routingArgumentIndex, method);
	} catch (NoSuchMethodException | SecurityException e) {
		throw new IllegalArgumentException("Cant route using: " + targetRoutingMethod , e);
	}
}
 
開發者ID:AvanzaBank,項目名稱:astrix,代碼行數:14,代碼來源:GsRoutingStrategy.java

示例3: astrixRoutingTakesPrecedence

import org.openspaces.remoting.Routing; //導入依賴的package包/類
@Test
public void astrixRoutingTakesPrecedence() throws Exception {
	class Service {
		@SuppressWarnings("unused")
		public void hello(@Routing String routingArg, @AstrixRouting String anotherArg) {
		}
	}
	Router router = new GsRoutingStrategy().create(Service.class.getMethod("hello", String.class, String.class));
	RoutingKey routingKey = router.getRoutingKey(new Object[]{"ignored-arg", "second-arg"});
	assertEquals(RoutingKey.create("second-arg"), routingKey);
}
 
開發者ID:AvanzaBank,項目名稱:astrix,代碼行數:12,代碼來源:GsRoutingStrategyTest.java

示例4: routesOnRoutingAnnotatedArgument

import org.openspaces.remoting.Routing; //導入依賴的package包/類
@Test
public void routesOnRoutingAnnotatedArgument() throws Exception {
	class Service {
		@SuppressWarnings("unused")
		public void hello(@Routing String routingArg, String anotherArg) {
		}
	}
	Router router = new GsRoutingStrategy().create(Service.class.getMethod("hello", String.class, String.class));
	RoutingKey routingKey = router.getRoutingKey(new Object[]{"routing-arg", "another-arg"});
	assertEquals(RoutingKey.create("routing-arg"), routingKey);
}
 
開發者ID:AvanzaBank,項目名稱:astrix,代碼行數:12,代碼來源:GsRoutingStrategyTest.java

示例5: routesOnRoutingAnnotatedArgumentPropertyIfDefined

import org.openspaces.remoting.Routing; //導入依賴的package包/類
@Test
public void routesOnRoutingAnnotatedArgumentPropertyIfDefined() throws Exception {
	class Service {
		@SuppressWarnings("unused")
		public void hello(@Routing("getRouting") ProperRoutingMethod routingArg) {
		}
	}
	
	Router router = new GsRoutingStrategy().create(Service.class.getMethod("hello", ProperRoutingMethod.class));
	RoutingKey routingKey = router.getRoutingKey(new Object[]{new ProperRoutingMethod()});
	assertEquals(RoutingKey.create("routing-arg"), routingKey);
}
 
開發者ID:AvanzaBank,項目名稱:astrix,代碼行數:13,代碼來源:GsRoutingStrategyTest.java

示例6: missingPropertyMethod_throwsIllegalArgumentException

import org.openspaces.remoting.Routing; //導入依賴的package包/類
@Test(expected = IllegalArgumentException.class)
public void missingPropertyMethod_throwsIllegalArgumentException() throws Exception {
	class Service {
		@SuppressWarnings("unused")
		public void hello(@Routing("getRouting") MissingRoutingMethod routingArg) {
		}
	}
	new GsRoutingStrategy().create(Service.class.getMethod("hello", MissingRoutingMethod.class));
}
 
開發者ID:AvanzaBank,項目名稱:astrix,代碼行數:10,代碼來源:GsRoutingStrategyTest.java

示例7: invalidPropertyMethod_throwsIllegalArgumentException

import org.openspaces.remoting.Routing; //導入依賴的package包/類
@Test(expected = IllegalArgumentException.class)
public void invalidPropertyMethod_throwsIllegalArgumentException() throws Exception {
	class Service {
		@SuppressWarnings("unused")
		public void hello(@Routing("getRouting") IllegalRoutingMethod routingArg) {
		}
	}
	
	new GsRoutingStrategy().create(Service.class.getMethod("hello", IllegalRoutingMethod.class));
}
 
開發者ID:AvanzaBank,項目名稱:astrix,代碼行數:11,代碼來源:GsRoutingStrategyTest.java

示例8: multipleRoutingAnnotations_throwsAmbiguousRoutingException

import org.openspaces.remoting.Routing; //導入依賴的package包/類
@Test(expected = AmbiguousRoutingException.class)
public void multipleRoutingAnnotations_throwsAmbiguousRoutingException() throws Exception {
	class Service {
		@SuppressWarnings("unused")
		public void hello(@Routing String routingArg, @Routing String routingArg2) {
		}
	}
	new GsRoutingStrategy().create(Service.class.getMethod("hello", String.class, String.class));
}
 
開發者ID:AvanzaBank,項目名稱:astrix,代碼行數:10,代碼來源:GsRoutingStrategyTest.java

示例9: addLunchRestaurant

import org.openspaces.remoting.Routing; //導入依賴的package包/類
@Override
public void addLunchRestaurant(@Routing String name) {
	LunchRestaurant r = new LunchRestaurant();
	r.setName(name);
	gigaSpace.write(r);
}
 
開發者ID:AvanzaBank,項目名稱:astrix,代碼行數:7,代碼來源:LunchServiceImpl.java

示例10: say

import org.openspaces.remoting.Routing; //導入依賴的package包/類
String say(@Routing String message); 
開發者ID:Gigaspaces,項目名稱:xap-openspaces,代碼行數:2,代碼來源:SimpleService.java

示例11: superSay

import org.openspaces.remoting.Routing; //導入依賴的package包/類
String superSay(@Routing String message); 
開發者ID:Gigaspaces,項目名稱:xap-openspaces,代碼行數:2,代碼來源:SuperSimpleService.java

示例12: getLunchRestaurant

import org.openspaces.remoting.Routing; //導入依賴的package包/類
Future<LunchRestaurant> getLunchRestaurant(@Routing String name); 
開發者ID:AvanzaBank,項目名稱:astrix,代碼行數:2,代碼來源:LunchServiceAsync.java

示例13: getLunchRestaurant

import org.openspaces.remoting.Routing; //導入依賴的package包/類
LunchRestaurant getLunchRestaurant(@Routing String name); 
開發者ID:AvanzaBank,項目名稱:astrix,代碼行數:2,代碼來源:LunchService.java

示例14: getAvarageGrade

import org.openspaces.remoting.Routing; //導入依賴的package包/類
double getAvarageGrade(@Routing String restaurantName); 
開發者ID:AvanzaBank,項目名稱:astrix,代碼行數:2,代碼來源:LunchRestaurantGrader.java

示例15: ping

import org.openspaces.remoting.Routing; //導入依賴的package包/類
String ping(@Routing String msg); 
開發者ID:AvanzaBank,項目名稱:astrix,代碼行數:2,代碼來源:Ping.java


注:本文中的org.openspaces.remoting.Routing類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。