001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.nio.intraband;
016    
017    import java.util.Queue;
018    
019    /**
020     * @author Shuyang Zhou
021     */
022    public class ChannelContext {
023    
024            public ChannelContext(Queue<Datagram> sendingQueue) {
025                    _sendingQueue = sendingQueue;
026            }
027    
028            public Datagram getReadingDatagram() {
029                    return _readingDatagram;
030            }
031    
032            public RegistrationReference getRegistrationReference() {
033                    return _registrationReference;
034            }
035    
036            public Queue<Datagram> getSendingQueue() {
037                    return _sendingQueue;
038            }
039    
040            public Datagram getWritingDatagram() {
041                    return _writingDatagram;
042            }
043    
044            public void setReadingDatagram(Datagram readingDatagram) {
045                    _readingDatagram = readingDatagram;
046            }
047    
048            public void setRegistrationReference(
049                    RegistrationReference registrationReference) {
050    
051                    _registrationReference = registrationReference;
052            }
053    
054            public void setWritingDatagram(Datagram writingDatagram) {
055                    _writingDatagram = writingDatagram;
056            }
057    
058            // All nonfinal fields are not thread safe. They depend on external logic to
059            // do thread safe publication and must be accessed solely by polling threads
060            // to remain thread safety.
061    
062            private Datagram _readingDatagram;
063            private RegistrationReference _registrationReference;
064            private final Queue<Datagram> _sendingQueue;
065            private Datagram _writingDatagram;
066    
067    }