我使用IntelliJ作为"Inspect Code",其结果之一是:
问题简介可以打包当地(第18行(public class HeartBeat))
这是什么意思,我该如何解决?
整个班级是这样的:
package com.xxxxxxxxxxx.app.xxxx;
public class HeartBeat
{
private static final Logger LOG = LoggerFactory.getLogger( HeartBeat.class );
private final File heartBeatFile;
public HeartBeat( File heartBeatFile )
{
this.heartBeatFile = heartBeatFile;
}
public void beat()
{
try
{
FileUtils.writeStringToFile( heartBeatFile, String.valueOf( System.currentTimeMillis() ) );
}
catch( IOException e )
{
LOG.error( "Error while writing heart beat log", e );
}
}
}
Run Code Online (Sandbox Code Playgroud) 如果我有相同的硬件,使用Kafka或我们当前的解决方案(ServiceMix/Camel).有什么区别吗?Kafka可以处理"更大"的数据吗?为什么?
有一篇文章谈论它有多快?但我仍然不清楚为什么Kafka与其他解决方案相比如此之快? 基准测试Apache Kafka:每秒200万次写入(在三台廉价机器上)
例如,我们有
{2,2,-1},
when k = 0, return -1.
when k = 3, return 3.
Run Code Online (Sandbox Code Playgroud)
这甚至是棘手的,因为我们有负数和一个额外的变量k.k可以是任何值,负数,不做任何假设.
我不能参考https://en.wikipedia.org/wiki/Maximum_subarray_problem和https://www.youtube.com/watch?v=yCQN096CwWM来解决这个问题.
有谁能够帮我?更好地使用Java或JavaScript.
这是最大的经典算法o(n)(无变量k):
public int maxSubArray(int[] nums) {
int max = nums[0];
int tsum = nums[0];
for(int i=1;i<nums.length;i++){
tsum = Math.max(tsum+nums[i],nums[i]);
max = Math.max(max,tsum);
}
return max;
}
Run Code Online (Sandbox Code Playgroud) algorithm queue dynamic-programming binary-search kadanes-algorithm
类SecureDispatchService这样从GWT:
@RemoteServiceRelativePath("dispatch")
public interface SecureDispatchService extends RemoteService {
Result execute( String sessionId, Action<?> action ) throws DispatchException;
}
Run Code Online (Sandbox Code Playgroud)
RemoteServiceRelativePath:
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface RemoteServiceRelativePath {
/**
* The relative path for the {@link RemoteService} implementation.
*
* @return relative path for the {@link RemoteService} implementation
*/
String value();
}
Run Code Online (Sandbox Code Playgroud)
测试代码非常简单:
package com.name.sbts.wbts.sm;
import net.customware.gwt.dispatch.client.secure.SecureDispatchService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
public class TestClass {
public static void main(String[] args) {
Class c = SecureDispatchService.class;
System.out.println(c.getAnnotation(RemoteServiceRelativePath.class));
System.out.println(c.getAnnotations().length);
}
}
Run Code Online (Sandbox Code Playgroud)
但结果不是这样的:
null …Run Code Online (Sandbox Code Playgroud) java ×2
algorithm ×1
annotations ×1
apache-kafka ×1
bigdata ×1
eclipse ×1
gwt ×1
gwt-rpc ×1
inspection ×1
queue ×1