- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我遇到这个问题,第一次处理此代码时,它运行良好,但第二次(第一次和第二次运行基于设置的 cron),它在失败文件夹中查找文件,然后删除成功文件夹并将其复制到失败文件夹中。我不知道为什么会发生这种情况?
<int-sftp:inbound-channel-adapter
id="sftpInboundAdapter"
session-factory="sftpSessionFactory"
remote-directory="${remote}"
local-directory="${local.download.folder}"
delete-remote-files="false"
channel="InboundChannel"
filter="CompositeIncomingFilesFilter"
auto-startup="true">
<int:poller cron="*/60 * * * * ?" error-channel="PollerErrorChannel">
<int:transactional transaction-manager="transactionManager" synchronization-factory="syncFactory" />
</int:poller>
</int-sftp:inbound-channel-adapter>
<bean id="transactionManager" class="org.springframework.integration.transaction.PseudoTransactionManager" />
<int:transaction-synchronization-factory id="syncFactory" >
<int:after-commit expression="payload.renameTo(new java.io.File('${local.download.folder}' + 'success/' + payload.name))" channel="afterCommitSuccessChannel" />
<int:after-rollback expression="payload.renameTo(new java.io.File('${local.download.folder}' + 'failed/' + payload.name))" channel="afterRollbackFailedChannel" />
</int:transaction-synchronization-factory>
<int:channel id="afterCommitSuccessChannel" />
<int:channel id="afterRollbackFailedChannel" />
<int:logging-channel-adapter id="afterCommitSuccessChannel" expression="'File saved and processed: ' + payload" level="INFO" />
<int:logging-channel-adapter id="afterRollbackFailedChannel" expression="'File was rollbacked: ' + payload" level="INFO" />
<bean id="CompositeIncomingFilesFilter" class="org.springframework.integration.file.filters.CompositeFileListFilter">
<constructor-arg>
<list>
<bean id="SftpFilterAlreadyDownloadedFiles" class="org.springframework.integration.sftp.filters.SftpPersistentAcceptOnceFileListFilter">
<constructor-arg index="0" ref="persistingMetadataStore" />
<constructor-arg index="1" value="prefix_" />
<property name = "flushOnUpdate" value = "true"/>
</bean>
<bean id="SftpFilterSimple" class="org.springframework.integration.sftp.filters.SftpSimplePatternFileListFilter">
<constructor-arg index="0" value="*123*.txt" />
</bean>
</list>
</constructor-arg>
</bean>
我的日志显示以下内容:
2018-10-23 11:29:04.597 INFO 12244 --- [ask-scheduler-2] o.s.integration.handler.LoggingHandler : File saved and processed: true
File saved and processed: true
2018-10-23 11:30:00.002 INFO 12244 --- [ask-scheduler-4] o.s.i.file.FileReadingMessageSource : Created message: [GenericMessage [payload=\local\failed, headers={id=6afc5dfb-5dd4-b234-5c35-a60a42931524, timestamp=1540287000002}]]
Created message: [GenericMessage [payload=\local\failed, headers={id=6afc5dfb-5dd4-b234-5c35-a60a42931524, timestamp=1540287000002}]]
2018-10-23 11:30:00.023 ERROR 12244 --- [ask-scheduler-4] i.a.ErrorMessageLoggerActivator : Message containing error inside channel: GenericMessage [payload=\local\failed, headers={id=6afc5dfb-5dd4-b234-5c35-a60a42931524, timestamp=1540287000002}]
Message containing error inside channel: GenericMessage [payload=\local\failed, headers={id=6afc5dfb-5dd4-b234-5c35-a60a42931524, timestamp=1540287000002}]
2018-10-23 11:30:00.023 ERROR 12244 --- [ask-scheduler-4] i.a.ErrorMessageLoggerActivator : ErrorMessageLoggerActivator exception:
ErrorMessageLoggerActivator exception:
2018-10-23 11:30:17.180 WARN 12244 --- [ask-scheduler-4] sftpInboundLogger : \local\failed
\local\failed
2018-10-23 11:30:17.192 INFO 12244 --- [ask-scheduler-4] o.s.integration.handler.LoggingHandler : File was rollbacked: false
File was rollbacked: false
2018-10-23 11:30:17.193 ERROR 12244 --- [ask-scheduler-4] i.e.InboundStreamErrorHandler : java.io.FileNotFoundException: \local\failed (Access is denied)
java.io.FileNotFoundException: \local\failed (Access is denied)
2018-10-23 11:31:00.001 INFO 12244 --- [ask-scheduler-5] o.s.i.file.FileReadingMessageSource : Created message: [GenericMessage [payload=\local\success, headers={id=4e12f55a-2b2a-ca79-fad3-1325b7b698fa, timestamp=1540287060001}]]
Created message: [GenericMessage [payload=\local\success, headers={id=4e12f55a-2b2a-ca79-fad3-1325b7b698fa, timestamp=1540287060001}]]
2018-10-23 11:31:00.022 WARN 12244 --- [ask-scheduler-5] sftpInboundLogger : \local\success
\local\success
2018-10-23 11:31:00.032 INFO 12244 --- [ask-scheduler-5] o.s.integration.handler.LoggingHandler : File was rollbacked: true
File was rollbacked: true
2018-10-23 11:31:00.034 ERROR 12244 --- [ask-scheduler-5] i.a.ErrorMessageLoggerActivator : Message containing error inside channel: ErrorMessage [payload=org.springframework.integration.transformer.MessageTransformationException: Failed to transform Message; nested exception is org.springframework.messaging.MessagingException: failed to transform File Message; nested exception is java.io.FileNotFoundException: \local\success (Access is denied), failedMessage=GenericMessage [payload=\local\success, headers={id=4e12f55a-2b2a-ca79-fad3-1325b7b698fa, timestamp=1540287060001}], failedMessage=GenericMessage [payload=\local\success, headers={id=4e12f55a-2b2a-ca79-fad3-1325b7b698fa, timestamp=1540287060001}], headers={id=9ac1bff3-2296-6166-115e-1e6fbc2ed304, timestamp=1540287060033}]
Message containing error inside channel: ErrorMessage [payload=org.springframework.integration.transformer.MessageTransformationException: Failed to transform Message; nested exception is org.springframework.messaging.MessagingException: failed to transform File Message; nested exception is java.io.FileNotFoundException: \local\success (Access is denied), failedMessage=GenericMessage [payload=\local\success, headers={id=4e12f55a-2b2a-ca79-fad3-1325b7b698fa, timestamp=1540287060001}], failedMessage=GenericMessage [payload=\local\success, headers={id=4e12f55a-2b2a-ca79-fad3-1325b7b698fa, timestamp=1540287060001}], headers={id=9ac1bff3-2296-6166-115e-1e6fbc2ed304, timestamp=1540287060033}]
2018-10-23 11:31:00.043 ERROR 12244 --- [ask-scheduler-5] i.a.ErrorMessageLoggerActivator : ErrorMessageLoggerActivator exception:
org.springframework.integration.transformer.MessageTransformationException: Failed to transform Message; nested exception is org.springframework.messaging.MessagingException: failed to transform File Message; nested exception is java.io.FileNotFoundException: \local\success (Access is denied), failedMessage=GenericMessage [payload=\local\success, headers={id=4e12f55a-2b2a-ca79-fad3-1325b7b698fa, timestamp=1540287060001}]
at org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:95)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:109)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:148)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:121)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:89)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:425)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:375)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105)
at org.springframework.integration.endpoint.SourcePollingChannelAdapter.handleMessage(SourcePollingChannelAdapter.java:210)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:272)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.access$000(AbstractPollingEndpoint.java:58)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:190)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:186)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy130.call(Unknown Source)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:353)
at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:55)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:51)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:344)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.messaging.MessagingException: failed to transform File Message; nested exception is java.io.FileNotFoundException: \local\success (Access is denied)
at org.springframework.integration.file.transformer.AbstractFilePayloadTransformer.transform(AbstractFilePayloadTransformer.java:101)
at org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:89)
... 43 common frames omitted
Caused by: java.io.FileNotFoundException: \local\success (Access is denied)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at org.springframework.util.FileCopyUtils.copyToByteArray(FileCopyUtils.java:92)
at org.springframework.integration.file.transformer.FileToByteArrayTransformer.transformFile(FileToByteArrayTransformer.java:32)
at org.springframework.integration.file.transformer.FileToByteArrayTransformer.transformFile(FileToByteArrayTransformer.java:28)
at org.springframework.integration.file.transformer.AbstractFilePayloadTransformer.transform(AbstractFilePayloadTransformer.java:87)
... 44 common frames omitted
ErrorMessageLoggerActivator exception:
org.springframework.integration.transformer.MessageTransformationException: Failed to transform Message; nested exception is org.springframework.messaging.MessagingException: failed to transform File Message; nested exception is java.io.FileNotFoundException: \local\success (Access is denied), failedMessage=GenericMessage [payload=\local\success, headers={id=4e12f55a-2b2a-ca79-fad3-1325b7b698fa, timestamp=1540287060001}]
at org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:95)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:109)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:148)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:121)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:89)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:425)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:375)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105)
at org.springframework.integration.endpoint.SourcePollingChannelAdapter.handleMessage(SourcePollingChannelAdapter.java:210)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:272)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.access$000(AbstractPollingEndpoint.java:58)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:190)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:186)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy130.call(Unknown Source)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:353)
at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:55)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:51)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:344)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.messaging.MessagingException: failed to transform File Message; nested exception is java.io.FileNotFoundException: \local\success (Access is denied)
at org.springframework.integration.file.transformer.AbstractFilePayloadTransformer.transform(AbstractFilePayloadTransformer.java:101)
at org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:89)
... 43 common frames omitted
Caused by: java.io.FileNotFoundException: \local\success (Access is denied)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at org.springframework.util.FileCopyUtils.copyToByteArray(FileCopyUtils.java:92)
at org.springframework.integration.file.transformer.FileToByteArrayTransformer.transformFile(FileToByteArrayTransformer.java:32)
at org.springframework.integration.file.transformer.FileToByteArrayTransformer.transformFile(FileToByteArrayTransformer.java:28)
at org.springframework.integration.file.transformer.AbstractFilePayloadTransformer.transform(AbstractFilePayloadTransformer.java:87)
... 44 common frames omitted
最佳答案
and then it moves the folder with the file under failure
好的。因此,当您将 /success
目录重命名为其他目录时,它就会消失,当然,您无法再向 /success
写入内容。您必须在建议中创建它才能将文件写入其中。如果您无法控制在写入文件之前创建的 /success
目录,则需要考虑单独重命名每个文件。
关于java - 同步工厂删除 sftp :inbound-channel-adapter 的文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52893345/
我正在实现 IMAP 客户端,但 IMAP 邮箱同步出现问题。 首先,可以从 IMAP 服务器获取新邮件,但我不知道如何从邮箱中查找已删除的邮件。 我是否应该从服务器获取所有消息并将其与本地数据进行比
我研究线程同步。当我有这个例子时: class A { public synchronized void methodA(){ } public synchronized void met
嗨,我做了一个扩展线程的东西,它添加了一个包含 IP 的对象。然后我创建了该线程的两个实例并启动它们。他们使用相同的列表。 我现在想使用 Synchronized 来阻止并发更新问题。但它不起作用,我
我正在尝试使用 FTP 定期将小数据文件从程序上传到服务器。用户从使用 javascript XMLHttpRequest 函数读取数据的网页访问数据。这一切似乎都有效,但我正在努力解决由 FTP 和
我不知道如何同步下一个代码: javascript: (function() { var s2 = document.createElement('script'); s2.src =
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 7 年前。 Improve this qu
一 点睛 1 Message 在基于 Message 的系统中,每一个 Event 也可以被称为 Message,Message 是对 Event 更高一个层级的抽象,每一个 Message 都有一个
一 点睛 1 Message 在基于 Message 的系统中,每一个 Event 也可以被称为 Message,Message 是对 Event 更高一个层级的抽象,每一个 Message 都有一个
目标:我所追求的是每次在数据库中添加某些内容时(在 $.ajax 到 Submit_to_db.php 之后),从数据库获取数据并刷新 main.php(通过 draw_polygon 更明显)。 所
我有一个重复动画,需要与其他一些 transient 动画同步。重复动画是一条在屏幕上移动 4 秒的扫描线。当它经过下面的图像时,这些图像需要“闪烁”。 闪烁的图像可以根据用户的意愿来来去去和移动。它
我有 b 个块,每个块有 t 个线程。 我可以用 __syncthreads() 同步特定块中的线程。例如 __global__ void aFunction() { for(i=0;i #
我正在使用azure表查询来检索分配给用户的所有错误实体。 此外,我更改了实体的属性以声明该实体处于处理模式。 处理完实体后,我将从表中删除该实体。 当我进行并行测试时,可能会发生查询期间,一个实体已
我想知道 SQLite 是如何实现它的。它基于文件锁定吗?当然,并不是每个访问它的用户都锁定了整个数据库;那效率极低。它是基于多个文件还是仅基于一个大文件? 如果有人能够简要概述一下 sqlite 中
我想post到php,当id EmpAgree1时,然后它的post变量EmpAgree=1;当id为EmpAgree2时,则后置变量EmpAgree=2等。但只是读取i的最后一个值,为什么?以及如何
CUBLAS 文档提到我们在读取标量结果之前需要同步: “此外,少数返回标量结果的函数,例如 amax()、amin、asum()、rotg()、rotmg()、dot() 和 nrm2(),通过引用
我知道下面的代码中缺少一些内容,我的问题是关于 RemoteImplementation 中的同步机制。我还了解到该网站和其他网站上有几个关于 RMI 和同步的问题;我在这里寻找明确的确认/矛盾。 我
我不太确定如何解决这个问题......所以我可能需要几次尝试才能正确回答这个问题。我有一个用于缓存方法结果的注释。我的代码目前是一个私有(private)分支,但我正在处理的部分从这里开始: http
我对 Java 非常失望,因为它不允许以下代码尽可能地并发移动。当没有同步时,两个线程会更频繁地切换,但是当尝试访问同步方法时,在第二个线程获得锁之前以及在第一个线程获得锁之前再次花费太长时间(比如
过去几周我一直在研究java多线程。我了解了synchronized,并理解synchronized避免了多个线程同时访问相同的属性。我编写此代码是为了在同一线程中运行两个线程。 val gate =
我有一个关于 Java 同步的简单问题。 请假设以下代码: public class Test { private String address; private int age;
我是一名优秀的程序员,十分优秀!