本文整理汇总了C#中Ice.getPropertyAsIntWithDefault方法的典型用法代码示例。如果您正苦于以下问题:C# Ice.getPropertyAsIntWithDefault方法的具体用法?C# Ice.getPropertyAsIntWithDefault怎么用?C# Ice.getPropertyAsIntWithDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ice
的用法示例。
在下文中一共展示了Ice.getPropertyAsIntWithDefault方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoggerAdminI
internal LoggerAdminI(Ice.Properties props, LoggerAdminLoggerI logger)
{
_maxLogCount = props.getPropertyAsIntWithDefault("Ice.Admin.Logger.KeepLogs", 100);
_maxTraceCount = props.getPropertyAsIntWithDefault("Ice.Admin.Logger.KeepTraces", 100);
_traceLevel = props.getPropertyAsInt("Ice.Trace.Admin.Logger");
_logger = logger;
}
示例2: LocatorI
public LocatorI(LookupPrx lookup, Ice.Properties properties, string instanceName, Ice.LocatorPrx voidLocator)
{
_lookup = lookup;
_timeout = properties.getPropertyAsIntWithDefault("IceLocatorDiscovery.Timeout", 300);
_retryCount = properties.getPropertyAsIntWithDefault("IceLocatorDiscovery.RetryCount", 3);
_retryDelay = properties.getPropertyAsIntWithDefault("IceLocatorDiscovery.RetryDelay", 2000);
_timer = IceInternal.Util.getInstance(lookup.ice_getCommunicator()).timer();
_instanceName = instanceName;
_warned = false;
_locator = lookup.ice_getCommunicator().getDefaultLocator();
_voidLocator = voidLocator;
_pendingRetryCount = 0;
}
示例3: ACMConfig
public ACMConfig(Ice.Properties p, Ice.Logger l, string prefix, ACMConfig dflt)
{
Debug.Assert(prefix != null);
string timeoutProperty;
if((prefix.Equals("Ice.ACM.Client") || prefix.Equals("Ice.ACM.Server")) &&
p.getProperty(prefix + ".Timeout").Length == 0)
{
timeoutProperty = prefix; // Deprecated property.
}
else
{
timeoutProperty = prefix + ".Timeout";
};
timeout = p.getPropertyAsIntWithDefault(timeoutProperty, dflt.timeout / 1000) * 1000;
int hb = p.getPropertyAsIntWithDefault(prefix + ".Heartbeat", (int)dflt.heartbeat);
if(hb >= (int)Ice.ACMHeartbeat.HeartbeatOff && hb <= (int)Ice.ACMHeartbeat.HeartbeatAlways)
{
heartbeat = (Ice.ACMHeartbeat)hb;
}
else
{
l.warning("invalid value for property `" + prefix + ".Heartbeat" +
"', default value will be used instead");
heartbeat = dflt.heartbeat;
}
int cl = p.getPropertyAsIntWithDefault(prefix + ".Close", (int)dflt.close);
if(cl >= (int)Ice.ACMClose.CloseOff && cl <= (int)Ice.ACMClose.CloseOnIdleForceful)
{
close = (Ice.ACMClose)cl;
}
else
{
l.warning("invalid value for property `" + prefix + ".Close" +
"', default value will be used instead");
close = dflt.close;
}
}
示例4: DefaultsAndOverrides
internal DefaultsAndOverrides(Ice.Properties properties)
{
string val;
defaultProtocol = properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp");
val = properties.getProperty("Ice.Default.Host");
if(val.Length != 0)
{
defaultHost = val;
}
else
{
defaultHost = null;
}
val = properties.getProperty("Ice.Override.Timeout");
if(val.Length > 0)
{
overrideTimeout = true;
overrideTimeoutValue = properties.getPropertyAsInt("Ice.Override.Timeout");
}
else
{
overrideTimeout = false;
overrideTimeoutValue = -1;
}
val = properties.getProperty("Ice.Override.ConnectTimeout");
if(val.Length > 0)
{
overrideConnectTimeout = true;
overrideConnectTimeoutValue = properties.getPropertyAsInt("Ice.Override.ConnectTimeout");
}
else
{
overrideConnectTimeout = false;
overrideConnectTimeoutValue = -1;
}
val = properties.getProperty("Ice.Override.CloseTimeout");
if(val.Length > 0)
{
overrideCloseTimeout = true;
overrideCloseTimeoutValue = properties.getPropertyAsInt("Ice.Override.CloseTimeout");
}
else
{
overrideCloseTimeout = false;
overrideCloseTimeoutValue = -1;
}
#if COMPACT
overrideCompress = false;
overrideCompressValue = false;
#else
val = properties.getProperty("Ice.Override.Compress");
if(val.Length > 0)
{
overrideCompress = true;
overrideCompressValue = properties.getPropertyAsInt("Ice.Override.Compress") != 0;
if(!BasicStream.compressible() && overrideCompressValue)
{
string lib = AssemblyUtil.runtime_ == AssemblyUtil.Runtime.Mono ? "bzip2 library" : "bzip2.dll";
Console.Error.WriteLine("warning: " + lib + " not found, Ice.Override.Compress ignored.");
overrideCompressValue = false;
}
}
else
{
overrideCompress = !BasicStream.compressible();
overrideCompressValue = false;
}
#endif
val = properties.getProperty("Ice.Override.Secure");
if(val.Length > 0)
{
overrideSecure = true;
overrideSecureValue = properties.getPropertyAsInt("Ice.Override.Secure") > 0;
}
else
{
overrideSecure = false;
overrideSecureValue = false;
}
defaultCollocationOptimization =
properties.getPropertyAsIntWithDefault("Ice.Default.CollocationOptimized", 1) > 0;
val = properties.getPropertyWithDefault("Ice.Default.EndpointSelection", "Random");
if(val.Equals("Random"))
{
defaultEndpointSelection = Ice.EndpointSelectionType.Random;
}
else if(val.Equals("Ordered"))
{
defaultEndpointSelection = Ice.EndpointSelectionType.Ordered;
}
else
//.........这里部分代码省略.........
示例5: DefaultsAndOverrides
//.........这里部分代码省略.........
else
{
overrideCloseTimeout = false;
overrideCloseTimeoutValue = -1;
}
#if COMPACT
overrideCompress = false;
overrideCompressValue = false;
#else
val = properties.getProperty("Ice.Override.Compress");
if(val.Length > 0)
{
overrideCompress = true;
overrideCompressValue = properties.getPropertyAsInt("Ice.Override.Compress") > 0;
if(!BasicStream.compressible() && overrideCompressValue)
{
string lib = AssemblyUtil.runtime_ == AssemblyUtil.Runtime.Mono ? "bzip2 library" : "bzip2.dll";
Console.Error.WriteLine("warning: " + lib + " not found, Ice.Override.Compress ignored.");
overrideCompressValue = false;
}
}
else
{
overrideCompress = !BasicStream.compressible();
overrideCompressValue = false;
}
#endif
val = properties.getProperty("Ice.Override.Secure");
if(val.Length > 0)
{
overrideSecure = true;
overrideSecureValue = properties.getPropertyAsInt("Ice.Override.Secure") > 0;
}
else
{
overrideSecure = false;
overrideSecureValue = false;
}
defaultCollocationOptimization =
properties.getPropertyAsIntWithDefault("Ice.Default.CollocationOptimized", 1) > 0;
val = properties.getPropertyWithDefault("Ice.Default.EndpointSelection", "Random");
if(val.Equals("Random"))
{
defaultEndpointSelection = Ice.EndpointSelectionType.Random;
}
else if(val.Equals("Ordered"))
{
defaultEndpointSelection = Ice.EndpointSelectionType.Ordered;
}
else
{
Ice.EndpointSelectionTypeParseException ex = new Ice.EndpointSelectionTypeParseException();
ex.str = "illegal value `" + val + "'; expected `Random' or `Ordered'";
throw ex;
}
defaultTimeout = properties.getPropertyAsIntWithDefault("Ice.Default.Timeout", 60000);
if(defaultTimeout < 1 && defaultTimeout != -1)
{
defaultTimeout = 60000;
StringBuilder msg = new StringBuilder("invalid value for Ice.Default.Timeout `");
msg.Append(properties.getProperty("Ice.Default.Timeout"));
msg.Append("': defaulting to 60000");
logger.warning(msg.ToString());
}
defaultLocatorCacheTimeout = properties.getPropertyAsIntWithDefault("Ice.Default.LocatorCacheTimeout", -1);
if(defaultLocatorCacheTimeout < -1)
{
defaultLocatorCacheTimeout = -1;
StringBuilder msg = new StringBuilder("invalid value for Ice.Default.LocatorCacheTimeout `");
msg.Append(properties.getProperty("Ice.Default.LocatorCacheTimeout"));
msg.Append("': defaulting to -1");
logger.warning(msg.ToString());
}
defaultInvocationTimeout = properties.getPropertyAsIntWithDefault("Ice.Default.InvocationTimeout", -1);
if(defaultInvocationTimeout < 1 && defaultInvocationTimeout != -1 && defaultInvocationTimeout != -2)
{
defaultInvocationTimeout = -1;
StringBuilder msg = new StringBuilder("invalid value for Ice.Default.InvocationTimeout `");
msg.Append(properties.getProperty("Ice.Default.InvocationTimeout"));
msg.Append("': defaulting to -1");
logger.warning(msg.ToString());
}
defaultPreferSecure = properties.getPropertyAsIntWithDefault("Ice.Default.PreferSecure", 0) > 0;
val = properties.getPropertyWithDefault("Ice.Default.EncodingVersion",
Ice.Util.encodingVersionToString(Ice.Util.currentEncoding));
defaultEncoding = Ice.Util.stringToEncodingVersion(val);
Protocol.checkSupportedEncoding(defaultEncoding);
bool slicedFormat = properties.getPropertyAsIntWithDefault("Ice.Default.SlicedFormat", 0) > 0;
defaultFormat = slicedFormat ? Ice.FormatType.SlicedFormat : Ice.FormatType.CompactFormat;
}
示例6: createNetworkProxy
private NetworkProxy createNetworkProxy(Ice.Properties props, int protocolSupport)
{
string proxyHost;
proxyHost = props.getProperty("Ice.SOCKSProxyHost");
if(proxyHost.Length > 0)
{
if(protocolSupport == Network.EnableIPv6)
{
throw new Ice.InitializationException("IPv6 only is not supported with SOCKS4 proxies");
}
int proxyPort = props.getPropertyAsIntWithDefault("Ice.SOCKSProxyPort", 1080);
return new SOCKSNetworkProxy(proxyHost, proxyPort);
}
proxyHost = props.getProperty("Ice.HTTPProxyHost");
if(proxyHost.Length > 0)
{
return new HTTPNetworkProxy(proxyHost, props.getPropertyAsIntWithDefault("Ice.HTTPProxyPort", 1080));
}
return null;
}
示例7: setTcpBufSize
public static void setTcpBufSize(Socket socket, Ice.Properties properties, Ice.Logger logger)
{
//
// By default, on Windows we use a 128KB buffer size. On Unix
// platforms, we use the system defaults.
//
int dfltBufSize = 0;
if(AssemblyUtil.platform_ == AssemblyUtil.Platform.Windows)
{
dfltBufSize = 128 * 1024;
}
int sizeRequested = properties.getPropertyAsIntWithDefault("Ice.TCP.RcvSize", dfltBufSize);
if(sizeRequested > 0)
{
//
// Try to set the buffer size. The kernel will silently adjust
// the size to an acceptable value. Then read the size back to
// get the size that was actually set.
//
setRecvBufferSize(socket, sizeRequested);
int size = getRecvBufferSize(socket);
if(size < sizeRequested) // Warn if the size that was set is less than the requested size.
{
logger.warning("TCP receive buffer size: requested size of " + sizeRequested + " adjusted to " +
size);
}
}
sizeRequested = properties.getPropertyAsIntWithDefault("Ice.TCP.SndSize", dfltBufSize);
if(sizeRequested > 0)
{
//
// Try to set the buffer size. The kernel will silently adjust
// the size to an acceptable value. Then read the size back to
// get the size that was actually set.
//
setSendBufferSize(socket, sizeRequested);
int size = getSendBufferSize(socket);
if(size < sizeRequested) // Warn if the size that was set is less than the requested size.
{
logger.warning("TCP send buffer size: requested size of " + sizeRequested + " adjusted to " + size);
}
}
}
示例8: setBufSize
private void setBufSize(Ice.Properties properties)
{
Debug.Assert(_fd != null);
for (int i = 0; i < 2; ++i)
{
string direction;
string prop;
int dfltSize;
if(i == 0)
{
direction = "receive";
prop = "Ice.UDP.RcvSize";
dfltSize = Network.getRecvBufferSize(_fd);
_rcvSize = dfltSize;
}
else
{
direction = "send";
prop = "Ice.UDP.SndSize";
dfltSize = Network.getSendBufferSize(_fd);
_sndSize = dfltSize;
}
//
// Get property for buffer size and check for sanity.
//
int sizeRequested = properties.getPropertyAsIntWithDefault(prop, dfltSize);
if(sizeRequested < (_udpOverhead + IceInternal.Protocol.headerSize))
{
_instance.logger().warning("Invalid " + prop + " value of " + sizeRequested + " adjusted to " +
dfltSize);
sizeRequested = dfltSize;
}
if(sizeRequested != dfltSize)
{
//
// Try to set the buffer size. The kernel will silently adjust
// the size to an acceptable value. Then read the size back to
// get the size that was actually set.
//
int sizeSet;
if(i == 0)
{
Network.setRecvBufferSize(_fd, sizeRequested);
_rcvSize = Network.getRecvBufferSize(_fd);
sizeSet = _rcvSize;
}
else
{
Network.setSendBufferSize(_fd, sizeRequested);
_sndSize = Network.getSendBufferSize(_fd);
sizeSet = _sndSize;
}
//
// Warn if the size that was set is less than the requested size.
//
if(sizeSet < sizeRequested)
{
_instance.logger().warning("UDP " + direction + " buffer size: requested size of " +
sizeRequested + " adjusted to " + sizeSet);
}
}
}
}