001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.reef.wake.remote; 020 021import org.apache.reef.tang.annotations.Name; 022import org.apache.reef.tang.annotations.NamedParameter; 023import org.apache.reef.wake.EStage; 024import org.apache.reef.wake.EventHandler; 025import org.apache.reef.wake.remote.impl.DefaultTransportEStage; 026import org.apache.reef.wake.remote.impl.ObjectSerializableCodec; 027import org.apache.reef.wake.remote.impl.TransportEvent; 028 029/** 030 * Configuration options and helper methods for Wake remoting. 031 */ 032public final class RemoteConfiguration { 033 034 /** 035 * The name of the remote manager. 036 */ 037 @NamedParameter(short_name = "rm_name", doc = "The name of the remote manager.", default_value = "REEF_CLIENT") 038 public static final class ManagerName implements Name<String> { 039 // Intentionally empty 040 } 041 042 /** 043 * The host address to be used for messages. 044 */ 045 @NamedParameter(short_name = "rm_host", doc = "The host address to be used for messages.", 046 default_value = "##UNKNOWN##") 047 public static final class HostAddress implements Name<String> { 048 // Intentionally empty 049 } 050 051 /** 052 * The port to be used for messages. 053 */ 054 @NamedParameter(short_name = "rm_port", doc = "The port to be used for messages.", default_value = "0") 055 public static final class Port implements Name<Integer> { 056 // Intentionally empty 057 } 058 059 /** 060 * The codec to be used for messages. 061 */ 062 @NamedParameter(doc = "The codec to be used for messages.", default_class = ObjectSerializableCodec.class) 063 public static final class MessageCodec implements Name<Codec<?>> { 064 // Intentionally empty 065 } 066 067 /** 068 * The event handler to be used for throwables. 069 */ 070 @NamedParameter(doc = "The event handler to be used for throwables.", default_class = DefaultErrorHandler.class) 071 public static final class ErrorHandler implements Name<EventHandler<Throwable>> { 072 // Intentionally empty 073 } 074 075 /** 076 * Whether or not to use the message ordering guarantee. 077 */ 078 @NamedParameter(short_name = "rm_order", 079 doc = "Whether or not to use the message ordering guarantee.", default_value = "true") 080 public static final class OrderingGuarantee implements Name<Boolean> { 081 // Intentionally empty 082 } 083 084 /** 085 * The number of tries. 086 */ 087 @NamedParameter(doc = "The number of tries.", default_value = "3") 088 public static final class NumberOfTries implements Name<Integer> { 089 // Intentionally empty 090 } 091 092 /** 093 * The timeout of connection retrying. 094 */ 095 @NamedParameter(doc = "The timeout of connection retrying.", default_value = "10000") 096 public static final class RetryTimeout implements Name<Integer> { 097 // Intentionally empty 098 } 099 100 /** 101 * Client stage for messaging transport. 102 */ 103 @NamedParameter(doc = "Client stage for messaging transport.", default_class = DefaultTransportEStage.class) 104 public static final class RemoteClientStage implements Name<EStage<TransportEvent>> { 105 // Intentionally empty 106 } 107 108 /** 109 * Server stage for messaging transport. 110 */ 111 @NamedParameter(doc = "Server stage for messaging transport.", default_class = DefaultTransportEStage.class) 112 public static final class RemoteServerStage implements Name<EStage<TransportEvent>> { 113 // Intentionally empty 114 } 115}