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.reggie.proxy; 19 20 import java.io.IOException; 21 import java.io.Serializable; 22 import org.apache.river.api.io.AtomicSerial; 23 import org.apache.river.api.io.AtomicSerial.GetArg; 24 import org.apache.river.api.io.Valid; 25 26 /* 27 * RenewResults contains the return values of a renewLeases call on the 28 * registrar. Instances are never visible to clients, they are private 29 * to the communication between the LeaseMap proxy and the registrar. 30 * 31 * @author Sun Microsystems, Inc. 32 * 33 */ 34 @AtomicSerial 35 public class RenewResults implements Serializable { 36 37 private static final long serialVersionUID = 2L; 38 39 /** 40 * The granted duration for each lease. The length of this array 41 * is the same as the length of the durations parameter to renewLeases, 42 * and is in the same order. If a duration is -1, it indicates that 43 * an exception was thrown for this lease. 44 * 45 * @serial 46 */ 47 public long[] durations; 48 /** 49 * Any exceptions thrown. The length of this array is the same as 50 * the number of -1 elements in durations. The exceptions are in 51 * order. 52 * 53 * @serial 54 */ 55 public Exception[] exceptions; 56 57 /** Simple constructor */ 58 public RenewResults(long[] durations, Exception[] exceptions) { 59 this.durations = durations; 60 this.exceptions = exceptions; 61 } 62 63 public RenewResults(GetArg arg) throws IOException{ 64 this(Valid.copy(arg.get("durations", null, long[].class)), 65 Valid.copy(arg.get("exceptions", null, Exception[].class))); 66 } 67 }