/**
         * 加载备份MQ配置
         * @throws EisException
         */
        public AbstractServiceProvider(String alt)
        {
            this.config = CacheManager.getInstance().getConfig();
            alt         = alt + ".";

            MQParameter receive = new MQParameter(config.getProperty(alt + ConfigConstants.MQ_PROVIDER_RECV_IP),
                                                  int.Parse(config.getProperty(alt + ConfigConstants.MQ_PROVIDER_RECV_PORT)),
                                                  config.getProperty(alt + ConfigConstants.MQ_PROVIDER_RECV_CHANNEL),
                                                  int.Parse(config.getProperty(alt + ConfigConstants.MQ_PROVIDER_RECV_CCSID)),
                                                  config.getProperty(alt + ConfigConstants.MQ_PROVIDER_RECV_QMANAGER),
                                                  config.getProperty(alt + ConfigConstants.MQ_PROVIDER_RECV_QUEUE));

            receiveList.Add(receive);

            MQParameter send = new MQParameter(config.getProperty(alt + ConfigConstants.MQ_PROVIDER_SEND_IP),
                                               int.Parse(config.getProperty(alt + ConfigConstants.MQ_PROVIDER_SEND_PORT)),
                                               config.getProperty(alt + ConfigConstants.MQ_PROVIDER_SEND_CHANNEL),
                                               int.Parse(config.getProperty(alt + ConfigConstants.MQ_PROVIDER_SEND_CCSID)),
                                               config.getProperty(alt + ConfigConstants.MQ_PROVIDER_SEND_QMANAGER),
                                               config.getProperty(alt + ConfigConstants.MQ_PROVIDER_SEND_QUEUE));

            sendList.Add(send);

            connectionPoolManager = new PoolableMQConnectionManager(sendList, receiveList,
                                                                    int.Parse(config.getProperty(ConfigConstants.MQ_PROVIDER_POOL_MAXNUM)),
                                                                    int.Parse(config.getProperty(ConfigConstants.MQ_PROVIDER_GETCONN_TIMEOUT)));

            ProviderShutDownHook.register(this);
        }
예제 #2
0
 internal AseConnection(string connectionString, IConnectionPoolManager connectionPoolManager)
 {
     ConnectionString          = connectionString;
     InternalConnectionTimeout = 15; // Default to 15s as per the SAP AseClient http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc20066.1570100/doc/html/san1364409555258.html
     _connectionPoolManager    = connectionPoolManager;
     NamedParameters           = true;
     _isDisposed = false;
 }
 /**
  * 重置连接池
  */
 protected void resetConnectionPoolManager()
 {
     try
     {
         connectionPoolManager.close();
         //			receiveList.remove(0);
         if (receiveList.Count > 0)
         {
             connectionPoolManager = new PoolableMQConnectionManager(sendList, receiveList,
                                                                     int.Parse(config.getProperty(ConfigConstants.MQ_PROVIDER_POOL_MAXNUM)),
                                                                     int.Parse(config.getProperty(ConfigConstants.MQ_PROVIDER_GETCONN_TIMEOUT)));
             LogUtil.Info(this, "已重置网络连接!");
         }
         else
         {
             stop();
         }
     }
     catch (Exception e)
     {
         LogUtil.Error(this, e.Message);
     }
 }
        /**
         * 加载主MQ配置
         * @throws EisException
         */
        public AbstractServiceProvider()
        {
            this.config = CacheManager.getInstance().getConfig();

//		String AltConfig = config.getProperty(ConfigConstants.ALTERNATIVE_PROVIDER_CONFIG);
//		if (AltConfig == null){
//			AltConfig = "";
//		}
//		String[] AltConfigArr = AltConfig.split(ConfigConstants.ALTERNATIVE_CONFIG_SPLIT);


//		List<MQParameter> receiveList = new ArrayList<MQParameter>();

            MQParameter receive = new MQParameter(config.getProperty(ConfigConstants.MQ_PROVIDER_RECV_IP),
                                                  int.Parse(config.getProperty(ConfigConstants.MQ_PROVIDER_RECV_PORT)),
                                                  config.getProperty(ConfigConstants.MQ_PROVIDER_RECV_CHANNEL),
                                                  int.Parse(config.getProperty(ConfigConstants.MQ_PROVIDER_RECV_CCSID)),
                                                  config.getProperty(ConfigConstants.MQ_PROVIDER_RECV_QMANAGER),
                                                  config.getProperty(ConfigConstants.MQ_PROVIDER_RECV_QUEUE));

            receiveList.Add(receive);

//		for (int i = 0; i < AltConfigArr.length; i++) {
//			String receiveAlt = AltConfigArr[i].trim();
//			MQParameter receive_t = new MQParameter(config.getProperty(receiveAlt + ConfigConstants.MQ_PROVIDER_RECV_IP),
//					Integer.parseInt(config.getProperty(receiveAlt + ConfigConstants.MQ_PROVIDER_RECV_PORT)),
//					config.getProperty(receiveAlt + ConfigConstants.MQ_PROVIDER_RECV_CHANNEL),
//					Integer.parseInt(config.getProperty(receiveAlt + ConfigConstants.MQ_PROVIDER_RECV_CCSID)),
//					config.getProperty(receiveAlt + ConfigConstants.MQ_PROVIDER_RECV_QMANAGER),
//					config.getProperty(receiveAlt + ConfigConstants.MQ_PROVIDER_RECV_QUEUE));
//
//			receiveList.add(receive_t);
//		}


//		List<MQParameter> sendList = new ArrayList<MQParameter>();

            MQParameter send = new MQParameter(config.getProperty(ConfigConstants.MQ_PROVIDER_SEND_IP),
                                               int.Parse(config.getProperty(ConfigConstants.MQ_PROVIDER_SEND_PORT)),
                                               config.getProperty(ConfigConstants.MQ_PROVIDER_SEND_CHANNEL),
                                               int.Parse(config.getProperty(ConfigConstants.MQ_PROVIDER_SEND_CCSID)),
                                               config.getProperty(ConfigConstants.MQ_PROVIDER_SEND_QMANAGER),
                                               config.getProperty(ConfigConstants.MQ_PROVIDER_SEND_QUEUE));

            sendList.Add(send);

//		for (int i = 0; i < AltConfigArr.length; i++) {
//			String sendAlt = AltConfigArr[i].trim();
//			MQParameter send_t = new MQParameter(config.getProperty(sendAlt + ConfigConstants.MQ_PROVIDER_SEND_IP),
//					Integer.parseInt(config.getProperty(sendAlt + ConfigConstants.MQ_PROVIDER_SEND_PORT)),
//					config.getProperty(sendAlt + ConfigConstants.MQ_PROVIDER_SEND_CHANNEL),
//					Integer.parseInt(config.getProperty(sendAlt + ConfigConstants.MQ_PROVIDER_SEND_CCSID)),
//					config.getProperty(sendAlt + ConfigConstants.MQ_PROVIDER_SEND_QMANAGER),
//					config.getProperty(sendAlt + ConfigConstants.MQ_PROVIDER_SEND_QUEUE));
//			sendList.add(send_t);
//		}


            connectionPoolManager = new PoolableMQConnectionManager(sendList, receiveList,
                                                                    int.Parse(config.getProperty(ConfigConstants.MQ_PROVIDER_POOL_MAXNUM)),
                                                                    int.Parse(config.getProperty(ConfigConstants.MQ_PROVIDER_GETCONN_TIMEOUT)));

            ProviderShutDownHook.register(this);
        }