001package org.apache.commons.jcs.auxiliary.lateral; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import org.apache.commons.jcs.engine.behavior.ICacheElement; 023 024import java.io.Serializable; 025 026/** 027 * This class wraps command to other laterals. It is essentially a 028 * JCS-TCP-Lateral packet. The headers specify the action the receiver should 029 * take. 030 */ 031public class LateralElementDescriptor<K, V> 032 implements Serializable 033{ 034 /** Don't change */ 035 private static final long serialVersionUID = 5268222498076063575L; 036 037 /** The Cache Element that we are distributing. */ 038 public ICacheElement<K, V> ce; 039 040 /** 041 * The id of the the source of the request. This is used to prevent infinite 042 * loops. 043 */ 044 public long requesterId; 045 046 /** The operation has been requested by the client. */ 047 public LateralCommand command = LateralCommand.UPDATE; 048 049 /** 050 * The hashcode value for this element. 051 */ 052 public int valHashCode = -1; 053 054 /** Constructor for the LateralElementDescriptor object */ 055 public LateralElementDescriptor() 056 { 057 super(); 058 } 059 060 /** 061 * Constructor for the LateralElementDescriptor object 062 * <p> 063 * @param ce ICacheElement<K, V> payload 064 */ 065 public LateralElementDescriptor( ICacheElement<K, V> ce ) 066 { 067 this.ce = ce; 068 } 069 070 /** 071 * @return String, all the important values that can be configured 072 */ 073 @Override 074 public String toString() 075 { 076 StringBuilder buf = new StringBuilder(); 077 buf.append( "\n LateralElementDescriptor " ); 078 buf.append( "\n command = [" + this.command + "]" ); 079 buf.append( "\n valHashCode = [" + this.valHashCode + "]" ); 080 buf.append( "\n ICacheElement = [" + this.ce + "]" ); 081 return buf.toString(); 082 } 083}