⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iiopswitch.java

📁 利用JAVA采用IIOP通讯的方式,支持weblogic及websphere
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
      else {
        this.m_IIopDownCounter1 = 0;
      }

      if (m_IIopDownCounter1 >= this.m_ReconnectCounter) {
        IIopDefine.m_IIopDown1 = IIopDefine.IIOP_DISCONNECT;
        m_IIopDownCounter1 = 0;
      }
    }
    else {
      if (m_SuccessFlag == IIopDefine.IIOP_EXCEPTION) {
        this.m_IIopDownCounter2++;
      }
      else {
        this.m_IIopDownCounter2 = 0;
      }

      if (m_IIopDownCounter2 >= this.m_ReconnectCounter) {
        IIopDefine.m_IIopDown2 = IIopDefine.IIOP_DISCONNECT;
        m_IIopDownCounter2 = 0;
      }
    }

    return 1;
  }

  public IIopDown getIIopDown() {
    if (IIopDefine.m_IIopDown1 == IIopDefine.IIOP_CONNECT &&
        IIopDefine.m_IIopDown2 == IIopDefine.IIOP_CONNECT) {
      if (m_CurDown == IIopDefine.SLAVE_SERVER) {
        m_CurDown = IIopDefine.MAIN_SERVER;

        IIopDefine.m_IIopDown1SendTimes++;
        if (IIopDefine.m_IIopDown1SendTimes > IIopDefine.MAX_SEND_TIMES) {
          IIopDefine.m_IIopDown1SendTimes = 0;

        }
        return m_IIopDown1;
      }
      else {
        m_CurDown = IIopDefine.SLAVE_SERVER;

        IIopDefine.m_IIopDown2SendTimes++;
        if (IIopDefine.m_IIopDown2SendTimes > IIopDefine.MAX_SEND_TIMES) {
          IIopDefine.m_IIopDown2SendTimes = 0;

        }
        return m_IIopDown2;
      }
    }
    else if (IIopDefine.m_IIopDown1 == IIopDefine.IIOP_CONNECT &&
             IIopDefine.m_IIopDown2 != IIopDefine.IIOP_CONNECT) {
      m_CurDown = IIopDefine.MAIN_SERVER;

      IIopDefine.m_IIopDown1SendTimes++;
      if (IIopDefine.m_IIopDown1SendTimes > IIopDefine.MAX_SEND_TIMES) {
        IIopDefine.m_IIopDown1SendTimes = 0;

      }
      return m_IIopDown1;
    }
    else if (IIopDefine.m_IIopDown1 != IIopDefine.IIOP_CONNECT &&
             IIopDefine.m_IIopDown2 == IIopDefine.IIOP_CONNECT) {
      m_CurDown = IIopDefine.SLAVE_SERVER;

      IIopDefine.m_IIopDown2SendTimes++;
      if (IIopDefine.m_IIopDown2SendTimes > IIopDefine.MAX_SEND_TIMES) {
        IIopDefine.m_IIopDown2SendTimes = 0;

      }
      return m_IIopDown2;
    }
    else {
      return null;
    }
  }

  public int reConnectIIopDown() {
    try {
      if (IIopDefine.m_IIopDown1 == IIopDefine.IIOP_DISCONNECT) {
        initIIop(IIopDefine.DOWN_TYPE, IIopDefine.MAIN_SERVER);

      }
      if (IIopDefine.m_IIopDown2 == IIopDefine.IIOP_DISCONNECT) {
        initIIop(IIopDefine.DOWN_TYPE, IIopDefine.SLAVE_SERVER);

      }
      return 1;
    }
    catch (Exception m_Exception) {
      this.putMsg( (Object) IIopDefine.RECONNECT_IIOP_ERROR_1);
      return -1;
    }
  }

  public int initIIop(int m_IIopType, int m_ServerType) {
    if (m_IIopType == IIopDefine.SENDDATA_TYPE) {
      if (m_ServerType == IIopDefine.MAIN_SERVER) {
        if (m_IIopSendData1Flag == false) {
          this.m_IIopSendData1 = new IIopSendData();
          this.m_IIopSendData1.setIIopParam(m_InitContextFac, m_IIopURL1,
                                            m_SendData_JndiName);
          if (this.m_IIopSendData1.initConnect(CollectorDefine.SEND_DATA_DEBUG) <
              0) {
            this.putMsg( (Object) IIopDefine.
                        CONNECT_MAIN_SERVER_SENDDATA_FAILURE);
            IIopDefine.m_IIopSendData1 = IIopDefine.IIOP_DISCONNECT;
            return -1;
          }
          else {
            this.putMsg( (Object) IIopDefine.
                        CONNECT_MAIN_SERVER_SENDDATA_SUCCESS);
            //m_IIopSendData1Flag = true;
            IIopDefine.m_IIopSendData1 = IIopDefine.IIOP_CONNECT;
            return 1;
          }
        }
        else {
          if (this.m_IIopSendData1.reConnect(CollectorDefine.SEND_DATA_DEBUG) <
              0) {
            this.putMsg( (Object) IIopDefine.
                        RECONNECT_MAIN_SERVER_SENDDATA_FAILURE);
            IIopDefine.m_IIopSendData1 = IIopDefine.IIOP_DISCONNECT;
            return -1;
          }
          else {
            this.putMsg( (Object) IIopDefine.
                        RECONNECT_MAIN_SEREVR_SENDDATA_SUCCESS);
            IIopDefine.m_IIopSendData1 = IIopDefine.IIOP_CONNECT;
            return 1;
          }
        }
      }
      else {
        if (m_IIopSendData2Flag == false) {
          this.m_IIopSendData2 = new IIopSendData();
          this.m_IIopSendData2.setIIopParam(m_InitContextFac, m_IIopURL2,
                                            m_SendData_JndiName);
          if (this.m_IIopSendData2.initConnect(CollectorDefine.SEND_DATA_DEBUG) <
              0) {
            this.putMsg( (Object) IIopDefine.
                        CONNECT_SLAVE_SERVER_SENDDATA_FAILURE);
            IIopDefine.m_IIopSendData2 = IIopDefine.IIOP_DISCONNECT;
            return -1;
          }
          else {
            this.putMsg( (Object) IIopDefine.
                        CONNECT_SLAVE_SERVER_SENDDATA_SUCCESS);
            //m_IIopSendData2Flag = true;
            IIopDefine.m_IIopSendData2 = IIopDefine.IIOP_CONNECT;
            return 1;
          }
        }
        else {
          if (this.m_IIopSendData2.reConnect(CollectorDefine.SEND_DATA_DEBUG) <
              0) {
            this.putMsg( (Object) IIopDefine.
                        RECONNECT_SLAVE_SERVER_SENDDATA_FAILURE);
            IIopDefine.m_IIopSendData2 = IIopDefine.IIOP_DISCONNECT;
            return -1;
          }
          else {
            this.putMsg( (Object) IIopDefine.
                        RECONNECT_SLAVE_SEREVR_SENDDATA_SUCCESS);
            IIopDefine.m_IIopSendData2 = IIopDefine.IIOP_CONNECT;
            return 1;
          }
        }
      }
    }
    else if (m_IIopType == IIopDefine.DOWN_TYPE) {
      if (m_ServerType == IIopDefine.MAIN_SERVER) {
        if (m_IIopDown1Flag == false) {
          this.m_IIopDown1 = new IIopDown();
          this.m_IIopDown1.setIIopParam(m_InitContextFac, m_IIopURL1,
                                        m_Down_JndiName);
          if (this.m_IIopDown1.initConnect(CollectorDefine.
                                           DOWNLOAD_TERMINAL_DEBUG) < 0) {
            this.putMsg( (Object) IIopDefine.CONNECT_MAIN_SERVER_DOWN_FAILURE);
            IIopDefine.m_IIopDown1 = IIopDefine.IIOP_DISCONNECT;
            return -1;
          }
          else {
            this.putMsg( (Object) IIopDefine.CONNECT_MAIN_SERVER_DOWN_SUCCESS);
            //m_IIopDown1Flag = true;
            IIopDefine.m_IIopDown1 = IIopDefine.IIOP_CONNECT;
            return 1;
          }
        }
        else {
          if (this.m_IIopDown1.reConnect(CollectorDefine.
                                         DOWNLOAD_TERMINAL_DEBUG) < 0) {
            this.putMsg( (Object) IIopDefine.RECONNECT_MAIN_SERVER_DOWN_FAILURE);
            IIopDefine.m_IIopDown1 = IIopDefine.IIOP_DISCONNECT;
            return -1;
          }
          else {
            this.putMsg( (Object) IIopDefine.RECONNECT_MAIN_SEREVR_DOWN_SUCCESS);
            IIopDefine.m_IIopDown1 = IIopDefine.IIOP_CONNECT;
            return 1;
          }
        }
      }
      else {
        if (m_IIopDown2Flag == false) {
          this.m_IIopDown2 = new IIopDown();
          this.m_IIopDown2.setIIopParam(m_InitContextFac, m_IIopURL2,
                                        m_Down_JndiName);
          if (this.m_IIopDown2.initConnect(CollectorDefine.
                                           DOWNLOAD_TERMINAL_DEBUG) < 0) {
            this.putMsg( (Object) IIopDefine.CONNECT_SLAVE_SERVER_DOWN_FAILURE);
            IIopDefine.m_IIopDown2 = IIopDefine.IIOP_DISCONNECT;
            return -1;
          }
          else {
            this.putMsg( (Object) IIopDefine.CONNECT_SLAVE_SERVER_DOWN_SUCCESS);
            //m_IIopDown2Flag = true;
            IIopDefine.m_IIopDown2 = IIopDefine.IIOP_CONNECT;
            return 1;
          }
        }
        else {
          if (this.m_IIopDown2.reConnect(CollectorDefine.
                                         DOWNLOAD_TERMINAL_DEBUG) < 0) {
            this.putMsg( (Object) IIopDefine.
                        RECONNECT_SLAVE_SERVER_DOWN_FAILURE);
            IIopDefine.m_IIopDown2 = IIopDefine.IIOP_DISCONNECT;
            return -1;
          }
          else {
            this.putMsg( (Object) IIopDefine.
                        RECONNECT_SLAVE_SEREVR_DOWN_SUCCESS);
            IIopDefine.m_IIopDown2 = IIopDefine.IIOP_CONNECT;
            return 1;
          }
        }
      }
    }
    else {
      if (m_ServerType == IIopDefine.MAIN_SERVER) {
        if (m_IIopEvent1Flag == false) {
          this.m_IIopEvent1 = new IIopEvent();
          this.m_IIopEvent1.setIIopParam(m_InitContextFac, m_IIopURL1,
                                         m_Event_JndiName);
          if (this.m_IIopEvent1.initConnect( /*SEND_EVENT_DEBUG*/) < 0) {
            this.putMsg( (Object) IIopDefine.
                        RECONNECT_SLAVE_SERVER_EVENT_FAILURE);
            System.out.println("event1 :IIopDefine.IIOP_DISCONNECT3");
            IIopDefine.m_IIopEvent1 = IIopDefine.IIOP_DISCONNECT;
            return -1;
          }
          else {
            this.putMsg( (Object) IIopDefine.CONNECT_MAIN_SERVER_EVENT_SUCCESS);
            //m_IIopEvent1Flag = true;
            IIopDefine.m_IIopEvent1 = IIopDefine.IIOP_CONNECT;
            return 1;
          }
        }
        else {
          if (this.m_IIopEvent1.reConnect( /*SEND_EVENT_DEBUG*/) < 0) {
            this.putMsg( (Object) IIopDefine.
                        RECONNECT_MAIN_SERVER_EVENT_FAILURE);
            System.out.println("event1 :IIopDefine.IIOP_DISCONNECT2");
            IIopDefine.m_IIopEvent1 = IIopDefine.IIOP_DISCONNECT;
            return -1;
          }
          else {
            this.putMsg( (Object) IIopDefine.
                        RECONNECT_MAIN_SEREVR_EVENT_SUCCESS);
            IIopDefine.m_IIopEvent1 = IIopDefine.IIOP_CONNECT;
            return 1;
          }
        }
      }
      else {
        if (m_IIopEvent2Flag == false) {
          this.m_IIopEvent2 = new IIopEvent();
          this.m_IIopEvent2.setIIopParam(m_InitContextFac, m_IIopURL2,
                                         m_Event_JndiName);
          if (this.m_IIopEvent2.initConnect( /*SEND_EVENT_DEBUG*/) < 0) {
            this.putMsg( (Object) IIopDefine.CONNECT_SLAVE_SERVER_EVENT_FAILURE);
            System.out.println("event2 :IIopDefine.IIOP_DISCONNECT2");
            IIopDefine.m_IIopEvent2 = IIopDefine.IIOP_DISCONNECT;
            return -1;
          }
          else {
            this.putMsg( (Object) IIopDefine.CONNECT_SLAVE_SERVER_EVENT_SUCCESS);
            //m_IIopEvent2Flag = true;
            IIopDefine.m_IIopEvent2 = IIopDefine.IIOP_CONNECT;
            return 1;
          }
        }
        else {
          if (this.m_IIopEvent2.reConnect( /*SEND_EVENT_DEBUG*/) < 0) {
            this.putMsg( (Object) IIopDefine.
                        RECONNECT_SLAVE_SERVER_EVENT_FAILURE);
            System.out.println("event2 :IIopDefine.IIOP_DISCONNECT1");

            IIopDefine.m_IIopEvent2 = IIopDefine.IIOP_DISCONNECT;
            return -1;
          }
          else {
            this.putMsg( (Object) IIopDefine.
                        RECONNECT_SLAVE_SEREVR_EVENT_SUCCESS);
            IIopDefine.m_IIopEvent2 = IIopDefine.IIOP_CONNECT;
            return 1;
          }
        }
      }
    }
  }

  public Object getMsg() {
    if (this.m_ArrayList.size() <= 0) {
      return null;
    }
    else {
      return (Object)this.m_ArrayList.remove(0);
    }
  }

  public int getMsgNum() {
    return this.m_ArrayList.size();
  }

  public int putMsg(Object m_Object) {
    this.m_ArrayList.add(m_Object);

    return 1;
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -