亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? vmmanagedconnection.java

?? 一個java方面的消息訂閱發送的源碼
?? JAVA
字號:
/**
 * Redistribution and use of this software and associated documentation
 * ("Software"), with or without modification, are permitted provided
 * that the following conditions are met:
 *
 * 1. Redistributions of source code must retain copyright
 *    statements and notices.  Redistributions must also contain a
 *    copy of this document.
 *
 * 2. Redistributions in binary form must reproduce the
 *    above copyright notice, this list of conditions and the
 *    following disclaimer in the documentation and/or other
 *    materials provided with the distribution.
 *
 * 3. The name "Exolab" must not be used to endorse or promote
 *    products derived from this Software without prior written
 *    permission of Exoffice Technologies.  For written permission,
 *    please contact info@exolab.org.
 *
 * 4. Products derived from this Software may not be called "Exolab"
 *    nor may "Exolab" appear in their names without prior written
 *    permission of Exoffice Technologies. Exolab is a registered
 *    trademark of Exoffice Technologies.
 *
 * 5. Due credit should be given to the Exolab Project
 *    (http://www.exolab.org/).
 *
 * THIS SOFTWARE IS PROVIDED BY EXOFFICE TECHNOLOGIES AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
 * EXOFFICE TECHNOLOGIES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Copyright 2003-2005 (C) Exoffice Technologies Inc. All Rights Reserved.
 *
 * $Id: VMManagedConnection.java,v 1.4 2005/06/04 14:28:52 tanderson Exp $
 */
package org.exolab.jms.net.vm;

import java.io.IOException;
import java.rmi.MarshalException;
import java.rmi.MarshalledObject;
import java.security.Principal;

import org.exolab.jms.common.uuid.UUIDGenerator;
import org.exolab.jms.net.connector.AbstractManagedConnection;
import org.exolab.jms.net.connector.Caller;
import org.exolab.jms.net.connector.CallerImpl;
import org.exolab.jms.net.connector.Connection;
import org.exolab.jms.net.connector.IllegalStateException;
import org.exolab.jms.net.connector.InvocationHandler;
import org.exolab.jms.net.connector.MarshalledInvocation;
import org.exolab.jms.net.connector.Request;
import org.exolab.jms.net.connector.ResourceException;
import org.exolab.jms.net.connector.Response;
import org.exolab.jms.net.connector.URIRequestInfo;
import org.exolab.jms.net.uri.InvalidURIException;
import org.exolab.jms.net.uri.URI;
import org.exolab.jms.net.uri.URIHelper;


/**
 * <code>VMManagedConnection</code> manages multiple <code>VMConnection</code>
 * instances.
 *
 * @author <a href="mailto:tma@netspace.net.au">Tim Anderson</a>
 * @version $Revision: 1.4 $ $Date: 2005/06/04 14:28:52 $
 */
class VMManagedConnection extends AbstractManagedConnection {

    /**
     * The invoker for delegating invocations to the remote managed connection.
     */
    private VMInvoker _remoteInvoker;

    /**
     * The invocation handler.
     */
    private InvocationHandler _invoker;

    /**
     * The remote address to which this is connected.
     */
    private URI _remoteURI;

    /**
     * The the local address that this connection is bound to.
     */
    private URI _localURI;

    /**
     * The security principal.
     */
    private Principal _principal;

    /**
     * Cached caller instance. Non-null if this is a server-side instance.
     */
    private Caller _caller;


    /**
     * Construct a new client <code>VMManagedConnection</code>.
     *
     * @param principal the security principal
     * @param info      the connection request info
     * @throws ResourceException for any error
     */
    protected VMManagedConnection(Principal principal, URIRequestInfo info)
            throws ResourceException {
        _remoteURI = info.getURI();
        try {
            _localURI = URIHelper.create("vm", null, -1,
                                         UUIDGenerator.create());
        } catch (InvalidURIException exception) {
            throw new ResourceException("Failed to generate local URI",
                                        exception);
        }
        VMInvoker invoker = new VMInvoker(this);
        _remoteInvoker = VMManagedConnectionAcceptor.connect(principal, info,
                                                             invoker,
                                                             _localURI);
        _principal = principal;
    }

    /**
     * Construct a new server <code>VMManagedConnection</code>.
     *
     * @param principal the security principal
     * @param info      the connection request info
     * @param client    the invoker which delegates invocations to the client
     *                  managed connection
     * @param uri       the URI representing the client
     */
    protected VMManagedConnection(Principal principal, URIRequestInfo info,
                                  VMInvoker client, URI uri) {
        _localURI = info.getURI();
        _remoteInvoker = client;
        _remoteURI = uri;
        _caller = new CallerImpl(_remoteURI, _localURI);
        _principal = principal;
    }

    /**
     * Creates a new connection handle for the underlying physical connection.
     *
     * @return a new connection handle
     * @throws IllegalStateException if an invocation handler hasn't been
     *                               registered
     */
    public synchronized Connection getConnection()
            throws IllegalStateException {
        if (_invoker == null) {
            throw new IllegalStateException("No InvocationHandler registered");
        }
        return new VMConnection(this);
    }

    /**
     * Registers a handler for handling invocations on objects exported via this
     * connection.
     *
     * @param handler the invocation handler
     * @throws IllegalStateException if a handler is already registered
     * @throws ResourceException     for any error
     */
    public synchronized void setInvocationHandler(InvocationHandler handler)
            throws ResourceException {
        if (_invoker != null) {
            throw new IllegalStateException(
                    "An invocation handler is already registered");
        }
        _invoker = handler;
    }

    /**
     * Determines if the underlying physical connection is alive.
     *
     * @return <code>true</code> if the connection is alive
     */
    public boolean isAlive() {
        boolean alive = false;
        VMInvoker invoker = null;
        synchronized (this) {
            invoker = _remoteInvoker;
        }
        if (invoker != null) {
            alive = invoker.isAlive();
        }
        return alive;
    }

    /**
     * Destroys the physical connection.
     *
     * @throws ResourceException for any error
     */
    public void destroy() throws ResourceException {
        synchronized (this) {
            _remoteInvoker = null;
        }
    }

    /**
     * Returns the remote address to which this is connected.
     *
     * @return the remote address to which this is connected
     */
    public URI getRemoteURI() {
        return _remoteURI;
    }

    /**
     * Returns the local address that this connection is bound to.
     *
     * @return the local address that this connection is bound to
     */
    public URI getLocalURI() {
        return _localURI;
    }

    /**
     * Determines if the security principal that owns this connection is the
     * same as that supplied.
     *
     * @param principal the principal to compare. May be <code>null</code>.
     * @return <code>true</code> if the principal that owns this connection is
     *         the same as <code>principal</code>
     */
    public boolean hasPrincipal(Principal principal) {
        boolean result = false;
        if ((_principal != null && _principal.equals(principal))
                || (_principal == null && principal == null)) {
            result = true;
        }
        return result;
    }

    /**
     * Invoke a method on a remote object.
     *
     * @param connection the connection performing the invocation
     * @param request    the request
     * @return the result of the invocation
     */
    protected Response invoke(Connection connection, Request request) {
        Response response;
        try {
            MarshalledObject wrappedRequest = new MarshalledObject(request);
            MarshalledObject wrappedResponse =
                    _remoteInvoker.invoke(wrappedRequest);
            response = (Response) wrappedResponse.get();
        } catch (ClassNotFoundException exception) {
            response = new Response(exception);
        } catch (IOException exception) {
            response = new Response(exception);
        }
        return response;
    }

    /**
     * Invoke a method on a local object.
     *
     * @param request the wrapped <code>Request</code>
     * @return the wrapped <code>Response</code>
     * @throws MarshalException if the request can't be unmarshalled or the
     *                          response can't be marshalled
     */
    protected MarshalledObject invokeLocal(MarshalledObject request)
            throws MarshalException {
        MarshalledInvocation invocation
                = new MarshalledInvocation(request, _caller);

        _invoker.invoke(invocation);
        MarshalledObject response = null;
        try {
            response = invocation.getMarshalledResponse();
        } catch (IOException exception) {
            throw new MarshalException("Failed to marshal response",
                                       exception);
        }
        return response;
    }

    /**
     * Determines if the local end of the connection is alive.
     *
     * @return <code>true</code> if the connection is alive
     */
    protected boolean isAliveLocal() {
        boolean alive = false;
        synchronized (this) {
            alive = (_remoteInvoker != null);
        }
        return alive;
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
7777精品伊人久久久大香线蕉超级流畅| a4yy欧美一区二区三区| 国产精品1区2区3区在线观看| 成人黄色在线网站| 欧美日韩综合在线| 日韩亚洲欧美综合| 中文字幕佐山爱一区二区免费| 日韩精品电影在线观看| 福利一区二区在线| 精品国产青草久久久久福利| 一区二区三区 在线观看视频 | 91精品国产手机| 2020国产精品自拍| 青青草国产精品97视觉盛宴 | 欧美日韩久久一区二区| 国产精品视频一二三区| 精品在线观看视频| 91精品欧美一区二区三区综合在| 亚洲视频1区2区| 大陆成人av片| 亚洲国产精品99久久久久久久久| 精品无码三级在线观看视频| 69堂精品视频| 亚洲成a人v欧美综合天堂下载| 91在线一区二区三区| 国产精品毛片高清在线完整版| 国产成人在线免费| 国产性天天综合网| 成人午夜免费电影| 欧美国产日韩在线观看| 成人理论电影网| 亚洲三级电影网站| 91久久精品一区二区三区| 一区二区三区在线视频观看58| 97se亚洲国产综合自在线不卡| 国产精品丝袜黑色高跟| 成人精品视频.| 自拍偷在线精品自拍偷无码专区| eeuss鲁片一区二区三区在线观看| 国产精品久久综合| 91免费精品国自产拍在线不卡 | www.性欧美| 日韩伦理电影网| 在线精品观看国产| 免费观看在线综合| 国产日韩三级在线| 91在线视频网址| 亚洲不卡一区二区三区| 91官网在线免费观看| 亚洲精品网站在线观看| 色婷婷亚洲精品| 亚洲免费资源在线播放| 91成人在线精品| 一区二区三区中文字幕| 欧美军同video69gay| 精品在线一区二区三区| 亚洲欧洲www| 欧美乱妇15p| 狠狠色狠狠色综合| 亚洲卡通欧美制服中文| 日韩久久精品一区| jlzzjlzz亚洲日本少妇| 午夜精品福利视频网站| 精品国产乱码久久久久久牛牛| 国产呦精品一区二区三区网站| 亚洲视频免费在线观看| 日韩午夜小视频| 成人精品视频.| 人人狠狠综合久久亚洲| 久久久一区二区三区捆绑**| 成人午夜私人影院| 亚洲国产裸拍裸体视频在线观看乱了| 欧美高清dvd| 成人成人成人在线视频| 日韩国产一区二| 中文字幕中文乱码欧美一区二区| 欧美日韩一区二区在线视频| 精品一区在线看| 亚洲成人免费影院| 国产精品二三区| 精品美女一区二区| 91丨九色丨蝌蚪富婆spa| 黄一区二区三区| 亚洲男帅同性gay1069| 久久免费看少妇高潮| 91看片淫黄大片一级在线观看| 丝袜诱惑制服诱惑色一区在线观看 | 欧美日韩精品欧美日韩精品一综合| 男男成人高潮片免费网站| 亚洲欧洲在线观看av| 26uuu亚洲| 欧美日韩国产精品自在自线| 久久激情五月婷婷| 亚洲制服丝袜av| 久久精品在这里| 欧美日韩国产首页在线观看| 国产一区二区精品在线观看| 一级中文字幕一区二区| 国产三级精品三级| 日韩一卡二卡三卡国产欧美| 成人开心网精品视频| 美女视频第一区二区三区免费观看网站| 亚洲精品久久久久久国产精华液| 久久久久国产免费免费 | 国产精一区二区三区| 琪琪久久久久日韩精品| 日韩激情一二三区| 亚洲成人福利片| 性做久久久久久免费观看| 国产精品护士白丝一区av| 久久亚洲春色中文字幕久久久| 欧美一区二视频| 精品视频999| 91视频免费播放| 国产精品亚洲第一| 免费观看91视频大全| 久久精品免费观看| 久久99国产精品免费网站| 日韩综合在线视频| 亚洲成人动漫精品| 视频一区在线播放| 美女在线观看视频一区二区| 麻豆91精品91久久久的内涵| 午夜av电影一区| 日韩在线一二三区| 无吗不卡中文字幕| 九色porny丨国产精品| 日韩高清不卡一区二区| 亚洲aⅴ怡春院| 亚洲日本乱码在线观看| **欧美大码日韩| 国产精品久久久久久久久搜平片 | 日本少妇一区二区| 美女视频黄 久久| 国产91富婆露脸刺激对白| 91在线精品秘密一区二区| 欧美曰成人黄网| 日韩一区二区三区免费看| 国产亚洲欧美一级| 国产精品久久三区| 日韩av电影免费观看高清完整版| 精品无人码麻豆乱码1区2区 | 亚洲欧洲日产国产综合网| 亚洲日本免费电影| 日本中文字幕一区| 大胆亚洲人体视频| 3d动漫精品啪啪一区二区竹菊| 日韩你懂的在线观看| 国产精品区一区二区三区 | 中文字幕一区av| 日韩精品久久久久久| 成人看片黄a免费看在线| 欧美日韩一区二区三区高清 | 国产成人夜色高潮福利影视| 色播五月激情综合网| 欧美videossexotv100| 亚洲精品视频观看| 久久99精品久久久久久久久久久久 | 久久久亚洲精品一区二区三区 | 天堂av在线一区| 国产一区二区0| 99精品一区二区| 欧美日本在线播放| 久久精品人人做人人爽97| 国产精品理论片| 六月婷婷色综合| 91老师国产黑色丝袜在线| 精品处破学生在线二十三| 亚洲成a人v欧美综合天堂| av中文字幕在线不卡| 久久久影视传媒| 免费视频一区二区| 欧美日韩色一区| 亚洲人成人一区二区在线观看| 韩国成人精品a∨在线观看| 欧美精品精品一区| 一区二区三区影院| 国产精品18久久久久久久久| 日韩一区二区免费视频| 午夜电影网一区| 欧美这里有精品| 亚洲另类色综合网站| 国产91精品入口| 精品久久久久久无| 麻豆成人在线观看| 这里是久久伊人| 亚洲成av人影院| 在线看一区二区| 一区二区三区中文在线| 色婷婷国产精品| 亚洲欧洲无码一区二区三区| 99免费精品在线| 国产欧美精品一区二区色综合朱莉| 奇米色777欧美一区二区| 91精品国产综合久久国产大片| 亚洲一区视频在线观看视频| 日本乱人伦aⅴ精品| 18欧美亚洲精品| 91福利在线看| 日韩在线a电影|