Hi Sushil

Thanks for your response.

I've tried another method to make "thread-safe" my class and it's (I think) faster 
than synchronization.

I've cloned (at runtime, into my method) the RE array when I used it.
Then every process has own array, and I think that's the faster way...

Obviously I hope that the Garbage Collector works properly (I've also assigned to 
"null" the array after the usage)... ;-)

bye
Celestino


  ----- Original Message ----- 
  From: Sureka, Sushil 
  To: 'Regexp Users List' 
  Sent: Monday, June 23, 2003 6:13 PM
  Subject: RE: problem with massive use


  I have run into the similar problem before. The issue was basically that RE
  code is not thread safe (In javadoc they go in details about it, in short it
  is for performance reasons). Please make sure that the call to match() is
  inside a synchronized block and that should take care of the issue.

  Sushil

  -----Original Message-----
  From: Celestino Bellone [mailto:[EMAIL PROTECTED] 
  Sent: Monday, June 23, 2003 8:31 AM
  To: [EMAIL PROTECTED]
  Subject: problem with massive use

  Hi everybody

  I've developed (with my colleagues) a RE-based java class (named
  CalcoloCodice) that evaluates a string and returns a "code" strictly
  dependentent on the string.

  The class contains different static String arrays (the expressions) that,
  via a static initializer, are converted into RE arrays.

  At runtime, the application calls a CalcoloCodice's static method that calls
  the match() method for every regexp until a code is found (and exits if
  anything is found) returning the result code.

  Occasionally (with no apparent reason), when there are a lot of users that
  uses the application, the following exception are trown by RE class:

  java.lang.StringIndexOutOfBoundsException: String index out of range: 7
          at java.lang.String.charAt(String.java:516)
          at
  org.apache.regexp.StringCharacterIterator.charAt(StringCharacterIterator.jav
  a:90)
          at org.apache.regexp.RE.matchNodes(RE.java:1209)
          at org.apache.regexp.RE.matchAt(RE.java:1448)
          at org.apache.regexp.RE.match(RE.java:1498)
          at org.apache.regexp.RE.match(RE.java:1468)
          at org.apache.regexp.RE.match(RE.java:1561)

  There are some people that can help me?

  Thanks a lot in advance

  Celestino

  P.S.: excuse me for my poor English... ;-)



  ---------------------------------------------------------------------
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]

  ---------------------------------------------------------------------
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to