override def preStart(): Unit = {
breaker = new CircuitBreaker(context.system.scheduler,
maxFailures = 1,
callTimeout = 30 seconds,
resetTimeout = 10 seconds)(context.dispatcher)
}
[...]
case Forwarded(file) =>
try{
breaker.withSyncCircuitBreaker {
val file = doParsingAndValidation()
file match {
case Success(parsedFile) =>
using((connectionFactory ? GetConnection).mapTo[Connection].waitForResult) { conn =>
conn.setAutoCommit(false)
doJDBCStuff()
conn.commit()
controller ! Processed(parsedFile)
}
case Failure(err) =>
controller ! Malformed(file, err)
}
}
} catch {
case ex: Exception => context.system.scheduler.scheduleOnce(5 seconds, self, Forwarded(file))(context.dispatcher)
}
Sys-akka.actor.pinned-dispatcher-7 [RUNNABLE, IN_NATIVE]
java.net.SocketInputStream.read(byte[], int, int)SocketInputStream.java:122
org.postgresql.core.VisibleBufferedInputStream.readMore(int)VisibleBufferedInputStream.java:143
org.postgresql.core.VisibleBufferedInputStream.ensureBytes(int)VisibleBufferedInputStream.java:112
org.postgresql.core.VisibleBufferedInputStream.read()VisibleBufferedInputStream.java:71
org.postgresql.core.PGStream.ReceiveChar()PGStream.java:269
org.postgresql.core.v3.QueryExecutorImpl.processCopyResults(CopyOperationImpl, boolean)QueryExecutorImpl.java:930
org.postgresql.core.v3.QueryExecutorImpl.endCopy(CopyInImpl)QueryExecutorImpl.java:828
org.postgresql.core.v3.CopyInImpl.endCopy()CopyInImpl.java:59
org.postgresql.copy.CopyManager.copyIn(String, Reader, int)CopyManager.java:145
org.postgresql.copy.CopyManager.copyIn(String, Reader)CopyManager.java:124
xx.xxxx.actors.FileProcessor$$anonfun$receive$1$$anonfun$applyOrElse$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$7$$anonfun$apply$8.apply(Seq)FileProcessor.scala:98
xx.xxxx.actors.FileProcessor$$anonfun$receive$1$$anonfun$applyOrElse$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$7$$anonfun$apply$8.apply(Object)FileProcessor.scala:84
scala.collection.Iterator$class.foreach(Iterator, Function1)Iterator.scala:743
scala.collection.AbstractIterator.foreach(Function1)Iterator.scala:1174
xx.xxxx.actors.FileProcessor$$anonfun$receive$1$$anonfun$applyOrElse$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$7.apply(PushbackReader)FileProcessor.scala:84
xx.xxxx.actors.FileProcessor$$anonfun$receive$1$$anonfun$applyOrElse$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$7.apply(Object)FileProcessor.scala:82
xx.xxxx.util.Cleaning$.using(Object, Function1)Cleaning.scala:12
xx.xxxx.actors.FileProcessor$$anonfun$receive$1$$anonfun$applyOrElse$1$$anonfun$apply$mcV$sp$1.apply(Connection)FileProcessor.scala:82
xx.xxxx.actors.FileProcessor$$anonfun$receive$1$$anonfun$applyOrElse$1$$anonfun$apply$mcV$sp$1.apply(Object)FileProcessor.scala:75
xx.xxxx.util.Cleaning$.using(Object, Function1)Cleaning.scala:12
xx.xxxx.actors.FileProcessor$$anonfun$receive$1$$anonfun$applyOrElse$1.apply$mcV$sp()FileProcessor.scala:75
xx.xxxx.actors.FileProcessor$$anonfun$receive$1$$anonfun$applyOrElse$1.apply()FileProcessor.scala:56
xx.xxxx.actors.FileProcessor$$anonfun$receive$1$$anonfun$applyOrElse$1.apply()FileProcessor.scala:56
akka.pattern.CircuitBreaker$$anonfun$withSyncCircuitBreaker$1.apply()CircuitBreaker.scala:135
akka.pattern.CircuitBreaker$$anonfun$withSyncCircuitBreaker$1.apply()CircuitBreaker.scala:135
akka.pattern.CircuitBreaker$State$class.callThrough(CircuitBreaker$State, Function0)CircuitBreaker.scala:296
akka.pattern.CircuitBreaker$Closed$.callThrough(Function0)CircuitBreaker.scala:345
akka.pattern.CircuitBreaker$Closed$.invoke(Function0)CircuitBreaker.scala:354
akka.pattern.CircuitBreaker.withCircuitBreaker(Function0)CircuitBreaker.scala:113
akka.pattern.CircuitBreaker.withSyncCircuitBreaker(Function0)CircuitBreaker.scala:135
xx.xxxx.actors.FileProcessor$$anonfun$receive$1.applyOrElse(Object, Function1)FileProcessor.scala:55
akka.actor.Actor$class.aroundReceive(Actor, PartialFunction, Object)Actor.scala:465
xx.xxxx.actors.FileProcessor.aroundReceive(PartialFunction, Object)FileProcessor.scala:27
akka.actor.ActorCell.receiveMessage(Object)ActorCell.scala:516
akka.actor.ActorCell.invoke(Envelope)ActorCell.scala:487
akka.dispatch.Mailbox.processMailbox(int, long)Mailbox.scala:238
akka.dispatch.Mailbox.run()Mailbox.scala:220
java.lang.Thread.run()Thread.java:744
Sys-akka.actor.pinned-dispatcher-6 [WAITING]
java.lang.Object.wait()Object.java:503
org.postgresql.core.v3.QueryExecutorImpl.waitOnLock()QueryExecutorImpl.java:91
org.postgresql.core.v3.QueryExecutorImpl.execute(Query, ParameterList, ResultHandler, int, int, int)QueryExecutorImpl.java:228
org.postgresql.jdbc2.AbstractJdbc2Connection.executeTransactionCommand(Query)AbstractJdbc2Connection.java:808
org.postgresql.jdbc2.AbstractJdbc2Connection.rollback()AbstractJdbc2Connection.java:861
com.zaxxer.hikari.proxy.ConnectionProxy.resetConnectionState()ConnectionProxy.java:192
com.zaxxer.hikari.proxy.ConnectionProxy.close()ConnectionProxy.java:305
java.lang.reflect.Method.invoke(Object, Object[])Method.java:606
xx.xxxx.util.Cleaning$.using(Object, Function1)Cleaning.scala:14
xx.xxxx.actors.FileProcessor$$anonfun$receive$1$$anonfun$applyOrElse$1.apply$mcV$sp()FileProcessor.scala:75
xx.xxxx.actors.FileProcessor$$anonfun$receive$1$$anonfun$applyOrElse$1.apply()FileProcessor.scala:56
xx.xxxx.actors.FileProcessor$$anonfun$receive$1$$anonfun$applyOrElse$1.apply()FileProcessor.scala:56
akka.pattern.CircuitBreaker$$anonfun$withSyncCircuitBreaker$1.apply()CircuitBreaker.scala:135
akka.pattern.CircuitBreaker$$anonfun$withSyncCircuitBreaker$1.apply()CircuitBreaker.scala:135
akka.pattern.CircuitBreaker$State$class.callThrough(CircuitBreaker$State, Function0)CircuitBreaker.scala:296
akka.pattern.CircuitBreaker$Closed$.callThrough(Function0)CircuitBreaker.scala:345
akka.pattern.CircuitBreaker$Closed$.invoke(Function0)CircuitBreaker.scala:354
akka.pattern.CircuitBreaker.withCircuitBreaker(Function0)CircuitBreaker.scala:113
akka.pattern.CircuitBreaker.withSyncCircuitBreaker(Function0)CircuitBreaker.scala:135
xx.xxxx.actors.FileProcessor$$anonfun$receive$1.applyOrElse(Object, Function1)FileProcessor.scala:55
akka.actor.Actor$class.aroundReceive(Actor, PartialFunction, Object)Actor.scala:465
xx.xxxx.actors.FileProcessor.aroundReceive(PartialFunction, Object)FileProcessor.scala:27
akka.actor.ActorCell.receiveMessage(Object)ActorCell.scala:516
akka.actor.ActorCell.invoke(Envelope)ActorCell.scala:487
akka.dispatch.Mailbox.processMailbox(int, long)Mailbox.scala:238
akka.dispatch.Mailbox.run()Mailbox.scala:220
java.lang.Thread.run()Thread.java:744
def using[C <: {def close()} , B](closeable: C)(getB: C => B): B =
try {
getB(closeable)
} finally {
closeable.close()
}
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
Sys-akka.actor.pinned-dispatcher-6 [WAITING]
java.lang.Object.wait()Object.java:503
org.postgresql.core.v3.QueryExecutorImpl.waitOnLock()QueryExecutorImpl.java:91
org.postgresql.core.v3.QueryExecutorImpl.execute(Query, ParameterList, ResultHandler, int, int, int)QueryExecutorImpl.java:228
org.postgresql.jdbc2.AbstractJdbc2Connection.executeTransactionCommand(Query)AbstractJdbc2Connection.java:808
org.postgresql.jdbc2.AbstractJdbc2Connection.rollback()AbstractJdbc2Connection.java:861
com.zaxxer.hikari.proxy.ConnectionProxy.resetConnectionState()ConnectionProxy.java:192
com.zaxxer.hikari.proxy.ConnectionProxy.close()ConnectionProxy.java:305
java.lang.reflect.Method.invoke(Object, Object[])Method.java:606
xx.xxxx.util.Cleaning$.using(Object, Function1)Cleaning.scala:14
xx.xxxx.actors.FileProcessor$$anonfun$receive$1$$anonfun$applyOrElse$1.apply$mcV$sp()FileProcessor.scala:75
xx.xxxx.actors.FileProcessor$$anonfun$receive$1$$anonfun$applyOrElse$1.apply()FileProcessor.scala:56
xx.xxxx.actors.FileProcessor$$anonfun$receive$1$$anonfun$applyOrElse$1.apply()FileProcessor.scala:56
akka.pattern.CircuitBreaker$$anonfun$withSyncCircuitBreaker$1.apply()CircuitBreaker.scala:135
akka.pattern.CircuitBreaker$$anonfun$withSyncCircuitBreaker$1.apply()CircuitBreaker.scala:135
akka.pattern.CircuitBreaker$State$class.callThrough(CircuitBreaker$State, Function0)CircuitBreaker.scala:296
akka.pattern.CircuitBreaker$Closed$.callThrough(Function0)CircuitBreaker.scala:345
akka.pattern.CircuitBreaker$Closed$.invoke(Function0)CircuitBreaker.scala:354
akka.pattern.CircuitBreaker.withCircuitBreaker(Function0)CircuitBreaker.scala:113
akka.pattern.CircuitBreaker.withSyncCircuitBreaker(Function0)CircuitBreaker.scala:135
xx.xxxx.actors.FileProcessor$$anonfun$receive$1.applyOrElse(Object, Function1)FileProcessor.scala:55
...
akka.actor.Actor$class.aroundReceive(Actor, PartialFunction, Object)Actor.scala:</spa
invalid byte sequence for encoding "UTF8": 0x00--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
val cpManager = conn.unwrap(classOf[PGConnection]).getCopyAPI
val stringBytes: Array[Byte] = batchStrings.toString().map(_.toByte).toArray
val copy = cpManager.copyIn(s"COPY tableName FROM STDIN WITH CSV")
try {
copy.writeToCopy(stringBytes, 0, stringBytes.length)
copy.endCopy()
} finally {
if(copy.isActive){
copy.cancelCopy()
}
}
conn.commit()
akka.pattern.AskTimeoutException: Ask timed out on [Actor[akka://catalinaSys/user/connectionFactory#-1136872742]] after [10000 ms]
After cleanup pool stats HikariPool-0 (total=19, inUse=1, avail=18, waiting=0)
case GetConnection => sender() ! datasource.map(ds => ds.getConnection).get
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/Ehzioy3jVoU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.
Patrik Nordwall
Typesafe - Reactive apps on the JVM
Twitter: @patriknw