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.cluster;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    
020    import java.io.InputStream;
021    import java.io.OutputStream;
022    
023    import org.jgroups.Address;
024    import org.jgroups.Message;
025    import org.jgroups.Receiver;
026    import org.jgroups.View;
027    
028    /**
029     * @author Tina Tian
030     */
031    public class BaseReceiver implements Receiver {
032    
033            @Override
034            public void block() {
035            }
036    
037            @Override
038            public void getState(OutputStream outputStream) throws Exception {
039            }
040    
041            public View getView() {
042                    return view;
043            }
044    
045            @Override
046            public void receive(Message message) {
047            }
048    
049            @Override
050            public void setState(InputStream inputStream) throws Exception {
051            }
052    
053            @Override
054            public void suspect(Address address) {
055            }
056    
057            @Override
058            public void unblock() {
059            }
060    
061            @Override
062            public void viewAccepted(View view) {
063                    if (_log.isInfoEnabled()) {
064                            _log.info("Accepted view " + view);
065                    }
066    
067                    this.view = view;
068            }
069    
070            protected volatile View view;
071    
072            private static Log _log = LogFactoryUtil.getLog(BaseReceiver.class);
073    
074    }