本文整理匯總了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;
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
示例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));
}
示例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));
}
示例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);
}
示例10: say
import org.openspaces.remoting.Routing; //導入依賴的package包/類
String say(@Routing String message);
示例11: superSay
import org.openspaces.remoting.Routing; //導入依賴的package包/類
String superSay(@Routing String message);
示例12: getLunchRestaurant
import org.openspaces.remoting.Routing; //導入依賴的package包/類
Future<LunchRestaurant> getLunchRestaurant(@Routing String name);
示例13: getLunchRestaurant
import org.openspaces.remoting.Routing; //導入依賴的package包/類
LunchRestaurant getLunchRestaurant(@Routing String name);
示例14: getAvarageGrade
import org.openspaces.remoting.Routing; //導入依賴的package包/類
double getAvarageGrade(@Routing String restaurantName);
示例15: ping
import org.openspaces.remoting.Routing; //導入依賴的package包/類
String ping(@Routing String msg);