001 /* 002 * Copyright (c) 2009 The openGion Project. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 013 * either express or implied. See the License for the specific language 014 * governing permissions and limitations under the License. 015 */ 016 package org.opengion.fukurou.util; 017 018 import java.util.Date ; 019 020 /** 021 * StopTimer ã¯ã€æŒ‡å®šã?ä¸?®šæ™‚é–“ã?é–“ã?å®Ÿè¡Œã‚’åœæ¢ã—ã¾ã™ã? 022 * 引数ã«ã€åœæ¢æ™‚é–“ã‚’ç§’å˜ä½ã§æŒ?®šã—ã¾ã™ã? 023 * åˆæœŸå€¤ã¯ã€?¼?ç§?ã§ã™ã? 024 * 025 * Usage: java org.opengion.fukurou.fukurou.util.StopTimer åœæ¢æ™‚é–“(ç§? [-T] 026 * 027 * @og.group ユーãƒ?‚£ãƒªãƒ?‚£ 028 * 029 * @version 4.0 030 * @author Kazuhiko Hasegawa 031 * @since JDK5.0, 032 */ 033 public final class StopTimer { 034 035 /** 036 * ã™ã¹ã¦ã?staticメソãƒ?ƒ‰ãªã®ã§ã€ã‚³ãƒ³ã‚¹ãƒˆãƒ©ã‚¯ã‚¿ã‚’呼ã³å‡ºã•ãªãã—ã¦ãŠãã¾ã™ã? 037 * 038 */ 039 private StopTimer() {} 040 041 /** 042 * 処ç?‚’実行ã™ã‚?main メソãƒ?ƒ‰ã§ã™ã? 043 * 044 * 引数ã«ã¯ã€å?ç?‚’åœæ¢ã™ã‚‹ ç§’æ•° ã‚’å?力ã—ã¾ã™ã? 045 * -T ã‚’å?力ã—ãŸå?åˆã?ã€å?ç?–‹å§‹æ™‚刻を表示ã—ã¾ã™ã? 046 * 047 * Usage: java org.opengion.fukurou.fukurou.util.StopTimer åœæ¢æ™‚é–“(ç§? [-T] 048 * 049 * @param args コマンド引数é…å? 050 */ 051 public static void main( final String[] args ) { 052 long stopTime ; 053 054 if( args.length >= 1 ) { stopTime = 1000L * Long.parseLong( args[0] ) ; } 055 else { 056 LogWriter.log("Usage: java org.opengion.fukurou.fukurou.util.StopTimer åœæ¢æ™‚é–“(ç§? [-T]"); 057 return; 058 } 059 060 if( args.length ==2 && "-T".equals( args[1] ) ) { 061 System.out.println( new Date() ); 062 } 063 064 try { 065 Thread.sleep( stopTime ); 066 } 067 catch( InterruptedException ex ) { 068 LogWriter.log( "InterruptedException:" + ex.getMessage() ); 069 } 070 } 071 }