001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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 org.jgroups.Address;
021    import org.jgroups.Message;
022    import org.jgroups.Receiver;
023    import org.jgroups.View;
024    
025    /**
026     * @author Tina Tian
027     */
028    public class BaseReceiver implements Receiver {
029    
030            @Override
031            public void block() {
032            }
033    
034            @Override
035            public byte[] getState() {
036                    return null;
037            }
038    
039            public View getView() {
040                    return view;
041            }
042    
043            @Override
044            public void receive(Message message) {
045            }
046    
047            @Override
048            public void setState(byte[] state) {
049            }
050    
051            @Override
052            public void suspect(Address address) {
053            }
054    
055            @Override
056            public void viewAccepted(View view) {
057                    if (_log.isInfoEnabled()) {
058                            _log.info("Accepted view " + view);
059                    }
060    
061                    this.view = view;
062            }
063    
064            protected volatile View view;
065    
066            private static Log _log = LogFactoryUtil.getLog(BaseReceiver.class);
067    
068    }