001/* 002 * $HeadURL: file:///opt/dev/not-yet-commons-ssl-SVN-repo/tags/commons-ssl-0.3.17/src/java/org/apache/commons/ssl/rmi/IntegerRMI.java $ 003 * $Revision: 121 $ 004 * $Date: 2007-11-13 21:26:57 -0800 (Tue, 13 Nov 2007) $ 005 * 006 * ==================================================================== 007 * Licensed to the Apache Software Foundation (ASF) under one 008 * or more contributor license agreements. See the NOTICE file 009 * distributed with this work for additional information 010 * regarding copyright ownership. The ASF licenses this file 011 * to you under the Apache License, Version 2.0 (the 012 * "License"); you may not use this file except in compliance 013 * with the License. You may obtain a copy of the License at 014 * 015 * http://www.apache.org/licenses/LICENSE-2.0 016 * 017 * Unless required by applicable law or agreed to in writing, 018 * software distributed under the License is distributed on an 019 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 020 * KIND, either express or implied. See the License for the 021 * specific language governing permissions and limitations 022 * under the License. 023 * ==================================================================== 024 * 025 * This software consists of voluntary contributions made by many 026 * individuals on behalf of the Apache Software Foundation. For more 027 * information on the Apache Software Foundation, please see 028 * <http://www.apache.org/>. 029 * 030 */ 031 032package org.apache.commons.ssl.rmi; 033 034import java.io.Serializable; 035import java.rmi.Remote; 036import java.rmi.RemoteException; 037import java.rmi.server.UnicastRemoteObject; 038 039/** 040 * @author Credit Union Central of British Columbia 041 * @author <a href="http://www.cucbc.com/">www.cucbc.com</a> 042 * @author <a href="mailto:juliusdavies@cucbc.com">juliusdavies@cucbc.com</a> 043 * @since 22-Feb-2007 044 */ 045public class IntegerRMI extends UnicastRemoteObject 046 implements Remote, Serializable, RemoteInteger { 047 private int i; 048 049 public IntegerRMI() throws RemoteException { 050 super(); 051 this.i = (int) Math.round(Math.random() * 1000000.0); 052 } 053 054 public int getInt() throws RemoteException { 055 return i; 056 } 057 058 public boolean equals(Object o) { 059 RemoteInteger ri = (RemoteInteger) o; 060 try { 061 return i == ri.getInt(); 062 } 063 catch (RemoteException re) { 064 return false; 065 } 066 } 067 068 069}