Hi,
When i am trying to run the following code in a loop in my application my thread is hanging the server.
/** * Finds the separator for time string. * * @param timeString time as a string. * @return separator. */ private static String findSeparator(String timeString) { String separator = ":"; if (timeString != null) { if (timeString.indexOf(separator) == -1) { separator = "\."; } } return separator; } /** * Convert the time in HH:MM to time in minutes. * * @param timeString time string to be converted (HH:MM:SS). * @return the time in HH:MM to time in minutes. */ public static int toMinutes(String timeString, String separator) { Assert.isTrue(validateTimeString(timeString, separator), "Invalid Time String [" + timeString + "]"); String[] timeParts = timeString.split(separator); int hrs = Integer.parseInt(timeParts[0]); int mins = Integer.parseInt(timeParts[1]); return (hrs * 60) + mins; } /** * Convert the time in HH:MM to time in minutes. * * @param timeString time string to be converted (HH:MM:SS). * @return the time in HH:MM to time in minutes. */ public static int toMinutes(String timeString) { int minutes = 0; if (timeString != null) { String separator = findSeparator(timeString); minutes = toMinutes(timeString, separator); } return minutes; }
below is log.
[11/23/10 16:58:13:232 CET] 00000027 ThreadMonitor W WSVR0605W: Thread "WebContainer : 1" (00000022) has been active for 720641 milliseconds and may be hung. There is/are 1 thread(s) in total in the server that may be hung.
at java.util.regex.Pattern.atom(Pattern.java:1885)
at java.util.regex.Pattern.sequence(Pattern.java:1794 )
at java.util.regex.Pattern.expr(Pattern.java:1687)
at java.util.regex.Pattern.compile(Pattern.java:1397)
at java.util.regex.Pattern.<init>(Pattern.java:1124)
at java.util.regex.Pattern.compile(Pattern.java:817)
at java.lang.String.split(String.java:2103)
at java.lang.String.split(String.java:2145)
Please help.
Thank you.
Kailas