1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 package org.apache.river.fiddler.proxy; 19 20 import java.io.IOException; 21 import org.apache.river.api.io.AtomicSerial; 22 import org.apache.river.api.io.AtomicSerial.GetArg; 23 24 /* 25 * This class acts as a data structure in which the results of renewal 26 * attempts made in the method <code>FiddlerImpl.renewLeases</code> are 27 * stored and returned. 28 * <p> 29 * Instances or this class are never visible to clients, they are private 30 * to the communication between the LeaseMap proxy and the Fiddler 31 * implementation of the lookup discovery service. 32 * 33 * @author Sun Microsystems, Inc. 34 * 35 */ 36 @AtomicSerial 37 public class FiddlerRenewResults implements java.io.Serializable { 38 39 private static final long serialVersionUID = 6793222607079853307L; 40 41 /** 42 * The granted duration for each lease. The length of this array 43 * is the same as the length of the durations parameter to renewLeases, 44 * and is in the same order. If a duration is -1, it indicates that 45 * an exception was thrown for this lease. 46 * 47 * @serial 48 */ 49 public long[] durations; 50 /** 51 * Exceptions thrown as a result of a renewal attempt in renewLeases. 52 * The length of this array is the same as the number of -1 elements 53 * in <code>durations</code> field of this class. Furthermore, the 54 * exceptions in this array are in order. 55 * 56 * @serial 57 */ 58 public Exception[] exceptions; 59 60 /** 61 * Constructs a new instance of FiddlerRenewResults. 62 * 63 * @param durations array containing the durations granted as a result 64 * of successful lease renewals. 65 * @param exceptions array containing the exceptions thrown as a result 66 * of an unsuccessful lease renewal. 67 */ 68 public FiddlerRenewResults(long[] durations, Exception[] exceptions) { 69 this.durations = durations; 70 this.exceptions = exceptions; 71 } 72 73 FiddlerRenewResults(GetArg arg) throws IOException { 74 this(((long[])(arg.get("durations", new long[0]))).clone(), 75 ( arg.get("exceptions", null) == null ? 76 (Exception[])null : (Exception[])arg.get("exceptions", null))); 77 } 78 }