diff --git a/.checkstyle b/.checkstyle index 5c19604616c737b748e76b76b8fa76b4d432648c..fd0e0101452b839396eef46417b5c92347fcb5cf 100644 --- a/.checkstyle +++ b/.checkstyle @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false"> - <local-check-config name="Kieker Checkstyle" location="lib/static-analysis/checkstyle-5.6/cs-conf.xml" type="project" description=""> - <additional-data name="protect-config-file" value="true"/> + <local-check-config name="Kieker Checkstyle" location="conf/cs-conf.xml" type="project" description=""> + <additional-data name="protect-config-file" value="false"/> </local-check-config> - <fileset name="all" enabled="true" check-config-name="Kieker Checkstyle" local="true"> + <fileset name="all" enabled="true" check-config-name="Sun Checks" local="false"> <file-match-pattern match-pattern="." include-pattern="true"/> </fileset> <filter name="FilesFromPackage" enabled="true"> @@ -16,5 +16,4 @@ <filter-data value="examples/userguide/appendix-Sigar/src"/> <filter-data value="src-gen/analysis"/> </filter> - <filter name="NonSrcDirs" enabled="true"/> </fileset-config> diff --git a/.classpath b/.classpath index fd7ad7fbda73f2f1dd3afff62fa9abe499976bc6..c9522874302b83b7bc8b2ce5f6be59334a9da5b6 100644 --- a/.classpath +++ b/.classpath @@ -12,6 +12,7 @@ <attribute name="maven.pomderived" value="true"/> </attributes> </classpathentry> + <classpathentry kind="src" path="conf"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> <attributes> <attribute name="maven.pomderived" value="true"/> diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 69c31cd493ce042398e9fe93d22b72beb46afa88..dd0d799ca5a2f6b653c27e0c695b8f43da5c6967 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,292 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=165 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=1 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=165 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000000000000000000000000000000000000..c19d56f789fec37222cbedf9416b0864a94918cd --- /dev/null +++ b/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,60 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Kieker - Profile +formatter_settings_version=12 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;junit;org;com;kieker;kieker.test; +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=true +sp_cleanup.always_use_this_for_non_static_method_access=true +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=false +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=true +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=true +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false +sp_cleanup.use_this_for_non_static_method_access=true +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=false diff --git a/conf/cs-conf.xml b/conf/cs-conf.xml new file mode 100644 index 0000000000000000000000000000000000000000..4d22e9d85aeb83024a2b27d5ee2237fb059de72f --- /dev/null +++ b/conf/cs-conf.xml @@ -0,0 +1,1236 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module PUBLIC + "-//Puppy Crawl//DTD Check Configuration 1.3//EN" + "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> + +<module name="Checker"> + + <!-- KIEKER default is warning instead of error --> + <property name="severity" value="error"/> + + <!-- KIEKER Filter --> + <module name="SuppressWithNearbyCommentFilter"> + <property name="commentFormat" value="NOCS"/> + <property name="checkFormat" value=".*"/> + <property name="influenceFormat" value="0"/> + </module> + + <!-- + If you set the basedir property below, then all reported file + names will be relative to the specified directory. See + http://checkstyle.sourceforge.net/5.x/config.html#Checker + + <property name="basedir" value="${basedir}"/> + <property name="localeCountry" value=""/> JVM locale country + <property name="localeLanguage" value=""/> JVM locale language + <property name="charset" value=""/> JVM file.encoding property + !--> + + + <!-- + !________________________________________________________________________________________ + ! + ! D U P L I C A T E S + !________________________________________________________________________________________ + !--> + <!-- Performs a line-by-line comparison of all code lines and reports duplicate code. !--> + <!-- See http://checkstyle.sf.net/config_duplicates.html !--> + <!-- KIEKER Does not work with headers!! + <module name="StrictDuplicateCode"> + <property name="min" value="12"/> + <property name="fileExtensions" value=""/> + </module> + --> + + <!-- + !________________________________________________________________________________________ + ! + ! H E A D E R S + !________________________________________________________________________________________ + !--> + <!-- NOTE: You may enable zero or one of these header checks, but not both. !--> + + <!-- Checks that a source file begins with a specified header. !--> + <!-- See http://checkstyle.sf.net/config_header.html !--> + <!-- KIEKER !--> + <module name="Header"> + <!--<property name="headerFile" value=""/>--> + <!--<property name="charset" value=""/>--> + <property name="header" value="/***************************************************************************\n * Copyright 2013 Kieker Project (http://kieker-monitoring.net)\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n ***************************************************************************/\n"/> + <property name="ignoreLines" value="2"/> + <property name="fileExtensions" value="java"/> + </module> + + <!-- Checks the header of a source file against a header file that contains a regular expression !--> + <!-- for each line of the source header. !--> + <!-- See http://checkstyle.sf.net/config_header.html !--> + <!-- Default: OFF + <module name="RegexpHeader"> + <property name="headerFile" value=""/> + <property name="charset" value=""/> + <property name="header" value=""/> + <property name="multiLines" value=""/> + <property name="fileExtensions" value=""/> + </module> + !--> + + <!-- + !________________________________________________________________________________________ + ! + ! J A V A D O C S + !________________________________________________________________________________________ + !--> + <!-- Checks that each Java package has a Javadoc file used for commenting. !--> + <!-- See http://checkstyle.sourceforge.net/config_javadoc.html#JavadocPackage !--> + <!-- KIEKER: OFF + <module name="JavadocPackage"> + <property name="severity" value="info"/> + <property name="allowLegacy" value="false"/> + </module> + !--> + + <!-- + !________________________________________________________________________________________ + ! + ! R E G E X P + !________________________________________________________________________________________ + !--> + <!-- A check for detecting that matches across multiple lines. Works with any file type. !--> + <!-- See http://checkstyle.sourceforge.net/config_regexp.html#RegexpMultiline !--> + <!-- Default: OFF + <module name="RegexpMultiline"> + <property name="format" value=""/> + <property name="message" value=""/> + <property name="ignoreCase" value="false"/> + <property name="minimum" value="0"/> + <property name="maximum" value="0"/> + <property name="fileExtensions" value=""/> + </module> + !--> + + <!-- A check for detecting single lines that match a supplied regular expression. Works with any file type. !--> + <!-- See http://checkstyle.sourceforge.net/config_regexp.html#RegexpSingleline !--> + <!-- Default: OFF + <module name="RegexpSingleline"> + <property name="format" value="\s+$"/> + <property name="message" value=""/> + <property name="ignoreCase" value="false"/> + <property name="minimum" value="0"/> + <property name="maximum" value="0"/> + <property name="fileExtensions" value=""/> + </module> + !--> + + <!-- + !________________________________________________________________________________________ + ! + ! M I S C E L L A N E O U S + !________________________________________________________________________________________ + !--> + <!-- Checks whether files end with a new line. !--> + <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile !--> + <module name="NewlineAtEndOfFile"> + <property name="lineSeparator" value="system"/> + <property name="fileExtensions" value="*.*"/> + </module> + + <!-- Checks that property files contain the same keys. !--> + <!-- See http://checkstyle.sf.net/config_misc.html#Translation !--> + <module name="Translation"> + <property name="fileExtensions" value="properties"/> + </module> + + + <!-- + !________________________________________________________________________________________ + ! + ! S I Z E V I O L A T I O N S + !________________________________________________________________________________________ + !--> + <!-- Checks for long source files. !--> + <!-- See http://checkstyle.sf.net/config_sizes.html !--> + <module name="FileLength"> + <property name="max" value="2000"/> + <property name="fileExtensions" value="java"/> + </module> + + + <!-- + !________________________________________________________________________________________ + ! + ! W H I T E S P A C E + !________________________________________________________________________________________ + !--> + <!-- Checks that there are no tab characters ('\t') in the source code. !--> + <!-- See http://checkstyle.sourceforge.net/config_whitespace.html#FileTabCharacter !--> + <!-- KIEKER we use TABs + <module name="FileTabCharacter"> + <property name="eachLine" value="false"/> + <property name="fileExtensions" value=""/> + </module> + --> + + <module name="TreeWalker"> + <!-- KIEKER --> + <property name="tabWidth" value="4"/> + <!-- KIEKER --> + <module name="kieker.test.tools.cs.AnalysisComponentConstructorCheck"> + <property name="ignoreAbstractClasses" value="true"/> + <property name="severity" value="${checkstyle.ignoreCustomKieker}" default="ignore"/> + </module> + <module name="kieker.test.tools.cs.MonitoringRecordFactoryConventionCheck"> + <property name="ignoreAbstractClasses" value="true"/> + <property name="severity" value="${checkstyle.ignoreCustomKieker}" default="ignore"/> + </module> + <module name="kieker.test.tools.cs.MissingSinceTagCheck"> + <property name="severity" value="${checkstyle.ignoreCustomKieker}" default="ignore"/> + </module> + <module name="kieker.test.tools.cs.NotAllowedSinceTagCheck"> + <property name="severity" value="${checkstyle.ignoreCustomKieker}" default="ignore"/> + </module> + <module name="kieker.test.tools.cs.NoBlockCommentsCheck"> + <property name="severity" value="${checkstyle.ignoreCustomKieker}" default="ignore"/> + </module> + <module name="FileContentsHolder"/> + + <!-- + !________________________________________________________________________________________ + ! + ! A N N O T A T I O N S + !________________________________________________________________________________________ + !--> + <!-- This check controls the usage style of annotations. !--> + <!-- See http://checkstyle.sourceforge.net/config_annotation.html#AnnotationUseStyle !--> + <module name ="AnnotationUseStyle"> + <property name="elementStyle" value="compact_no_array"/> + <property name="closingParens" value="never"/> + <property name="trailingArrayComma" value="never"/> + </module> + + <!-- Verifies that both the java.lang.Deprecated import is present and the @deprecated Javadoc tag is present when either is present. !--> + <!-- See http://checkstyle.sourceforge.net/config_annotation.html#MissingDeprecated !--> + <!-- KIEKER --> + <module name="MissingDeprecated"> + <property name="severity" value="info"/> + </module> + + <!-- Verifies that the java.lang.Override annotation is present when the {@inheritDoc} javadoc tag is present. !--> + <!-- See http://checkstyle.sourceforge.net/config_annotation.html#MissingOverride !--> + <!-- problems with Java 1.5 + <module name="MissingOverride"> + <property name="javaFiveCompatibility" value="false"/> + </module> + --> + + <!-- This check makes sure that all package annotations are in the package-info.java file. !--> + <!-- See http://checkstyle.sourceforge.net/config_annotation.html#PackageAnnotation !--> + <module name="PackageAnnotation"/> + + <!-- This check allows you to specify what warnings that SuppressWarnings is not allowed to suppress. !--> + <!-- You can also specify a list of TokenTypes that the configured warning(s) cannot be suppressed on. !--> + <!-- See http://checkstyle.sourceforge.net/config_annotation.html#SuppressWarnings !--> + <module name="SuppressWarnings"> + <property name="format" value="^$|^\s+$"/> + <property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF, + ANNOTATION_FIELD_DEF, ENUM_CONSTANT_DEF, PARAMETER_DEF, + VARIABLE_DEF, METHOD_DEF, CTOR_DEF"/> + </module> + + + <!-- + !________________________________________________________________________________________ + ! + ! B L O C K S + !________________________________________________________________________________________ + !--> + <!-- Finds nested blocks, i.e. blocks that are used freely in the code. !--> + <!-- See http://checkstyle.sf.net/config_blocks.html !--> + <!-- KIEKER allowInSwitchCase !--> + <module name="AvoidNestedBlocks"> + <property name="allowInSwitchCase" value="true"/> + </module> + + <!-- Checks for empty blocks. !--> + <!-- See http://checkstyle.sf.net/config_blocks.html !--> + <!-- KIEKER removed LITERAL_CATCH !--> + <module name="EmptyBlock"> + <property name="option" value="stmt"/> + <property name="tokens" value="LITERAL_DO, + LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF, LITERAL_FOR, + LITERAL_TRY, LITERAL_WHILE, INSTANCE_INIT, STATIC_INIT"/> + </module> + + <!-- Checks for the placement of left curly braces ('{') for code blocks. !--> + <!-- See http://checkstyle.sf.net/config_blocks.html !--> + <module name="LeftCurly"> + <property name="option" value="eol"/> + <property name="maxLineLength" value="165"/> + <property name="tokens" value="CLASS_DEF, CTOR_DEF, + INTERFACE_DEF, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, + LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_SWITCH, + LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, + METHOD_DEF"/> + </module> + + <!-- Checks for braces around code blocks. !--> + <!-- See http://checkstyle.sf.net/config_blocks.html !--> + <module name="NeedBraces"> + <property name="tokens" value="LITERAL_DO, LITERAL_ELSE, LITERAL_IF, LITERAL_FOR, LITERAL_WHILE"/> + </module> + + <!-- Checks the placement of right curly braces ('}') for else, try, and catch tokens. !--> + <!-- See http://checkstyle.sf.net/config_blocks.html !--> + <module name="RightCurly"> + <property name="option" value="same"/> + <property name="tokens" value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE"/> + <property name="shouldStartLine" value="true"/> + </module> + + + <!-- + !________________________________________________________________________________________ + ! + ! C L A S S D E S I G N + !________________________________________________________________________________________ + !--> + <!-- Checks that classes are designed for extension. !--> + <!-- See http://checkstyle.sf.net/config_design.html !--> + <!-- Default: OFF + <module name="DesignForExtension"/> + !--> + + <!-- Checks that a class which has only private constructors is declared as final. !--> + <!-- See http://checkstyle.sf.net/config_design.html !--> + <module name="FinalClass"/> + + <!-- Make sure that utility classes (classes that contain only static methods) do not have a public constructor. !--> + <!-- See http://checkstyle.sf.net/config_design.html !--> + <module name="HideUtilityClassConstructor"/> + + <!-- Check nested (internal) classes/interfaces are declared at the bottom of the class after all method and field declarations. !--> + <!-- See http://checkstyle.sourceforge.net/config_design.html#InnerTypeLast !--> + <module name="InnerTypeLast"/> + + <!-- Implements Bloch, Effective Java, Item 17 - Use Interfaces only to define types. !--> + <!-- See http://checkstyle.sf.net/config_design.html !--> + <module name="InterfaceIsType"> + <property name="allowMarkerInterfaces" value="true"/> + </module> + + <!-- Ensures that exceptions (defined as any class name conforming to some regular expression) are immutable. !--> + <!-- That is, have only final fields. !--> + <!-- See http://checkstyle.sf.net/config_design.html !--> + <module name="MutableException"> + <property name="format" value="^.*Exception$|^.*Error$"/> + </module> + + <!-- Restricts throws statements to a specified count. !--> + <!-- See http://checkstyle.sf.net/config_design.html !--> + <!-- KIEKER off + <module name="ThrowsCount"> + <property name="max" value="1"/> + </module> + !--> + + <!-- Checks visibility of class members. !--> + <!-- See http://checkstyle.sf.net/config_design.html !--> + <module name="VisibilityModifier"> + <property name="packageAllowed" value="false"/> + <property name="protectedAllowed" value="true"/> + <property name="publicMemberPattern" value="^serialVersionUID$"/> + </module> + + + <!-- + !________________________________________________________________________________________ + ! + ! C O D I N G + !________________________________________________________________________________________ + !--> + <!-- Checks that array initialization contains a trailing comma. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="ArrayTrailingComma"/> + + <!-- Detects inline conditionals. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="AvoidInlineConditionals"/> + + <!-- Checks that classes that define a covariant equals() method also override method equals(java.lang.Object). !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="CovariantEquals"/> + + <!-- Checks declaration order according to Code Conventions for the Java Programming Language. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="DeclarationOrder"> + <property name="ignoreConstructors" value="false"/> + <property name="ignoreMethods" value="false"/> + <property name="ignoreModifiers" value="false"/> + </module> + + <!-- Check that the default is after all the cases in a switch statement. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="DefaultComesLast"/> + + <!-- The "double-checked locking" idiom (DCL) tries to avoid the runtime cost of synchronization. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <!--<module name="DoubleCheckedLocking"/>--> + + <!-- Detects empty statements (standalone ;). !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="EmptyStatement"/> + + <!-- Checks that any combination of String literals with optional assignment is on the left side of an equals() comparison. !--> + <!-- See http://checkstyle.sourceforge.net/config_coding.html#EqualsAvoidNull !--> + <module name="EqualsAvoidNull"/> + + <!-- Checks that classes that override equals() also override hashCode(). !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="EqualsHashCode"/> + + <!-- Checks if any class or object member explicitly initialized to default for its type value. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <!-- KIEKER off + <module name="ExplicitInitialization"/> + !--> + + <!-- Checks for fall through in switch statements Finds locations where a case contains Java code ... !--> + <!-- but lacks a break, return, throw or continue statement. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="FallThrough"> + <property name="checkLastCaseGroup" value="false"/> + <property name="reliefPattern" value="fallthru|falls??through"/> + </module> + + <!-- Checks that local variables that never have their values changed are declared final. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="FinalLocalVariable"> + <property name="tokens" value="VARIABLE_DEF"/> + </module> + + <!-- Checks that a local variable or a parameter does not shadow a field that is defined in the same class. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <!-- KIEKER ignoreConstructorParameter, ignoreSetter --> + <module name="HiddenField"> + <property name="tokens" value="PARAMETER_DEF, VARIABLE_DEF"/> + <!-- + <property name="ignoreFormat" value=""/> + !--> + <property name="ignoreConstructorParameter" value="true"/> + <property name="ignoreSetter" value="true"/> + <property name="ignoreAbstractMethods" value="false"/> + </module> + + <!-- Catching java.lang.Exception, java.lang.Error or java.lang.RuntimeException is almost never acceptable. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="IllegalCatch"> + <property name="illegalClassNames" value="java.lang.Exception, java.lang.Throwable, java.lang.RuntimeException"/> + </module> + + <!-- Checks for illegal instantiations where a factory method is preferred. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <!-- KIEKER on for ??? !--> + <module name="IllegalInstantiation"> + <property name="classes" value="java.lang.Boolean"/> + </module> + + <!-- This check can be used to ensure that types are not declared to be thrown. !--> + <!-- Declaring to throw java.lang.Error or java.lang.RuntimeException is almost never acceptable. !--> + <!-- See http://checkstyle.sourceforge.net/config_coding.html#IllegalThrows !--> + <module name="IllegalThrows"> + <property name="illegalClassNames" value="java.lang.Throwable, java.lang.Error, java.lang.RuntimeException"/> + </module> + + <!-- Checks for illegal tokens. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <!-- KIEKER off + <module name="IllegalToken"> + <property name="tokens" value="LITERAL_SWITCH, POST_INC, POST_DEC"/> + </module> + !--> + + <!-- Checks for illegal token text. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <!-- Default: OFF + <module name="IllegalTokenText"> + <property name="tokens" value=""/> + <property name="format" value=""/> + <property name="ignoreCase" value="false"/> + <property name="message" value=""/> + </module> + !--> + + <!-- Checks that particular classes are never used as types in variable declarations, return values or parameters. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <!-- KIEKER removed format value="^(.*[\\.])?Abstract.*$" !--> + <module name="IllegalType"> + <property name="tokens" value="PARAMETER_DEF, VARIABLE_DEF, METHOD_DEF"/> + <property name="illegalClassNames" value="java.util.GregorianCalendar, java.util.Hashtable, + java.util.HashSet, java.util.HashMap, java.util.ArrayList, + java.util.LinkedList, java.util.LinkedHashMap, + java.util.LinkedHashSet, java.util.TreeSet, + java.util.TreeMap, java.util.Vector"/> + <property name="legalAbstractClassNames" value=""/> + <property name="ignoredMethodNames" value="getInitialContext, getEnvironment"/> + <property name="format" value="XXX"/> + </module> + + <!-- Checks for assignments in subexpressions, such as in String s = Integer.toString(i = 2);. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="InnerAssignment"> + <property name="tokens" value="ASSIGN, BAND_ASSIGN, BOR_ASSIGN, BSR_ASSIGN, BXOR_ASSIGN, + DIV_ASSIGN, MINUS_ASSIGN, MOD_ASSIGN, PLUS_ASSIGN, SL_ASSIGN, + SR_ASSIGN, STAR_ASSIGN"/> + </module> + + <!-- Ensures that the setUp(), tearDown()methods are named correctly, have no arguments, !--> + <!-- return void and are either public or protected. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="JUnitTestCase"/> + + <!-- Checks that there are no "magic numbers", where a magic number is a numeric literal !--> + <!-- that is not defined as a constant. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <!-- deactivated for Kieker + <module name="MagicNumber"> + <property name="tokens" value="NUM_DOUBLE, NUM_FLOAT, NUM_INT, NUM_LONG"/> + <property name="ignoreNumbers" value="-1, 0, 1, 2"/> + <property name="ignoreHashCodeMethod" value="false"/> + </module> + !--> + + <!-- Checks that classes (except abtract one) define a ctor and don't rely on the default one. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="MissingCtor"/> + + <!-- Checks that switch statement has "default" clause. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="MissingSwitchDefault"/> + + <!-- Check for ensuring that for loop control variables are not modified inside the for block. !--> + <!-- See http://checkstyle.sourceforge.net/config_coding.html#ModifiedControlVariable !--> + <module name="ModifiedControlVariable"/> + + <!-- Checks for multiple occurrences of the same string literal within a single file. !--> + <!-- See http://checkstyle.sourceforge.net/config_coding.html#MultipleStringLiterals !--> + <!-- KIEKER off for now + <module name="MultipleStringLiterals"> + <property name="allowedDuplicates" value="1"/> + <property name="ignoreStringsRegexp" value='^""$'/> + <property name="ignoreOccurrenceContext" value="ANNOTATION"/> + </module> + !--> + + <!-- Checks that each variable declaration is in its own statement and on its own line. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="MultipleVariableDeclarations"/> + + <!-- Restricts nested for blocks to a specified depth. !--> + <!-- See http://checkstyle.sourceforge.net/config_coding.html#NestedForDepth !--> + <module name="NestedForDepth"> + <property name="max" value="2"/> + </module> + + <!-- Restricts nested if-else blocks to a specified depth. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="NestedIfDepth"> + <property name="max" value="3"/> + </module> + + <!-- Restricts nested try-catch blocks to a specified depth. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="NestedTryDepth"> + <property name="max" value="1"/> + </module> + + <!-- Checks that the clone method is not overridden from the Object class. !--> + <!-- See http://checkstyle.sourceforge.net/config_coding.html#NoClone !--> + <module name="NoClone"/> + + <!-- Verifies there are no finalize() methods defined in a class. !--> + <!-- See http://checkstyle.sourceforge.net/config_coding.html#NoFinalizer !--> + <module name="NoFinalizer"/> + + <!-- Checks there is only one statement per line. !--> + <!-- See http://checkstyle.sourceforge.net/config_coding.html#OneStatementPerLine !--> + <module name="OneStatementPerLine"/> + + <!-- Ensure a class has a package declaration. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="PackageDeclaration"> + <property name="ignoreDirectoryName" value="false"/> + </module> + + <!-- Disallow assignment of parameters. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="ParameterAssignment"/> + + <!-- Checks for redundant exceptions declared in throws clause such as duplicates, !--> + <!-- unchecked exceptions or subclasses of another declared exception. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="RedundantThrows"> + <property name="allowUnchecked" value="true"/> + <property name="allowSubclasses" value="false"/> + <property name="logLoadErrors" value="true"/> + <property name="suppressLoadErrors" value="false"/> + </module> + + <!-- Checks that code doesn't rely on the "this." default. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="RequireThis"> + <property name="checkFields" value="true"/> + <property name="checkMethods" value="true"/> + </module> + + <!-- Restrict the number of return statements. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="ReturnCount"> + <property name="max" value="2"/> + <property name="format" value=""/> + </module> + + <!-- Checks for overly complicated boolean expressions. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + + <module name="SimplifyBooleanExpression"/> + + <!-- Checks for overly complicated boolean return statements. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="SimplifyBooleanReturn"/> + + <!-- Checks that string literals are not used with == or !=. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="StringLiteralEquality"/> + + <!-- Checks that an overriding clone() method invokes super.clone(). !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="SuperClone"/> + + <!-- Checks that an overriding finalize() method invokes super.finalize(). !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="SuperFinalize"/> + + <!-- Checks for the use of unnecessary parentheses. !--> + <!-- See http://checkstyle.sf.net/config_coding.html !--> + <module name="UnnecessaryParentheses"/> + + + <!-- + !________________________________________________________________________________________ + ! + ! I M P O R T S + !________________________________________________________________________________________ + !--> + <!-- Checks that there are no import statements that use the * notation. !--> + <!-- See http://checkstyle.sf.net/config_import.html !--> + <module name="AvoidStarImport"> + <property name="excludes" value=""/> + <property name="allowClassImports" value="false"/> + <property name="allowStaticMemberImports" value="false"/> + </module> + + <!-- Checks that there are no static import statements. !--> + <!-- See http://checkstyle.sourceforge.net/config_imports.html#AvoidStaticImport !--> + <module name="AvoidStaticImport"> + <property name="excludes" value=""/> + </module> + + <!-- Checks for imports from a set of illegal packages. !--> + <!-- See http://checkstyle.sf.net/config_import.html !--> + <module name="IllegalImport"> + <property name="illegalPkgs" value="junit.framework"/> + <property name="illegalPkgs" value="sun"/> + <property name="illegalPkgs" value="org.apache.commons.logging"/> + <property name="illegalPkgs" value="java.util.logging"/> + </module> + + <!-- Controls what can be imported in each package. Useful for ensuring that application layering rules !--> + <!-- are not violated, especially on large projects. !--> + <!-- See http://checkstyle.sourceforge.net/config_imports.html#ImportControl !--> + <!-- Default: OFF + <module name="ImportControl"> + <property name="file" value=""/> + <property name="url" value=""/> + </module> + !--> + + <!-- Checks the ordering/grouping of imports. !--> + <!-- See http://checkstyle.sf.net/config_import.html !--> + <module name="ImportOrder"> + <property name="option" value="under"/> + <property name="groups" value="java,javax,junit,org,com,ch,de,kieker,kieker.test"/> + <property name="ordered" value="true"/> + <property name="separated" value="true"/> + <property name="caseSensitive" value="true"/> + </module> + + <!-- Checks for redundant import statements. !--> + <!-- See http://checkstyle.sf.net/config_import.html !--> + <module name="RedundantImport"/> + + <!-- Checks for unused import statements. !--> + <!-- See http://checkstyle.sf.net/config_import.html !--> + <module name="UnusedImports"/> + + + <!-- + !________________________________________________________________________________________ + ! + ! J A V A D O C S + !________________________________________________________________________________________ + !--> + <!-- Checks to ensure that the javadoc tags exist (if required) !--> + <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocMethod !--> + <!-- KIEKER: adapted !--> + <module name="JavadocMethod"> + <property name="severity" value="info"/> + <property name="scope" value="protected"/> + <!-- + <property name="excludeScope" value=""/> + !--> + <property name="allowUndeclaredRTE" value="false"/> + <property name="allowThrowsTagsForSubclasses" value="false"/> + <property name="allowMissingParamTags" value="false"/> + <property name="allowMissingThrowsTags" value="false"/> + <property name="allowMissingReturnTag" value="false"/> + <property name="allowMissingJavadoc" value="false"/> + <property name="allowMissingPropertyJavadoc" value="true"/> + <property name="logLoadErrors" value="true"/> + <property name="suppressLoadErrors" value="false"/> + <property name="tokens" value="METHOD_DEF, CTOR_DEF"/> + </module> + + <!-- Validates Javadoc comments to help ensure they are well formed. !--> + <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocStyle !--> + <module name="JavadocStyle"> + <property name="severity" value="info"/> + <property name="scope" value="private"/> + <!-- + <property name="excludeScope" value=""/> + !--> + <property name="checkFirstSentence" value="true"/> +<!--TODO: <property name="endOfSentenceFormat" value="([.?!][ \t\n\r\f<])|([.?!]$)"/> !--> + <property name="checkEmptyJavadoc" value="false"/> + <property name="checkHtml" value="false"/> + <property name="tokens" value="INTERFACE_DEF, CLASS_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/> + </module> + + <!-- Checks Javadoc comments for class and interface definitions. !--> + <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocType !--> + <module name="JavadocType"> + <property name="severity" value="info"/> + <property name="scope" value="private"/> + <!--<property name="excludeScope" value=""/>!--> + <property name="authorFormat" value=""/> + <!--<property name="versionFormat" value=""/>!--> + <property name="allowMissingParamTags" value="false"/> + <property name="allowUnknownTags" value="false"/> + <property name="tokens" value="INTERFACE_DEF, CLASS_DEF"/> + </module> + + <module name="JavadocType"> + <property name="severity" value="error"/> + <property name="scope" value="package"/> + <property name="authorFormat" value="\S"/> + </module> + + <!-- Checks that variables have Javadoc comments. !--> + <!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocVariable !--> + <module name="JavadocVariable"> + <property name="severity" value="info"/> + <property name="scope" value="protected"/> + <!-- + <property name="excludeScope" value=""/> + !--> + </module> + + <!-- Outputs a JavaDoc tag as information. !--> + <!-- See http://checkstyle.sourceforge.net/config_javadoc.html#WriteTag !--> + <!-- KIEKER + <module name="WriteTag"> + <property name="severity" value="info"/> + <property name="tag" value=""/> + <property name="tagFormat" value=""/> + <property name="tagSeverity" value="info"/> + </module> + --> + + + <!-- + !________________________________________________________________________________________ + ! + ! M E T R I C S + !________________________________________________________________________________________ + !--> + <!-- Restrict the number of number of &&, || and ^ in an expression. !--> + <!-- See http://checkstyle.sf.net/config_metrics.html !--> + <!-- KIEKER Off --> + <!-- <module name="BooleanExpressionComplexity"> + <property name="severity" value="info"/> + <property name="max" value="3"/> + <property name="tokens" value="LAND, BAND, LOR, BOR, BXOR"/> + </module> --> + + <!-- This metric measures the number of instantiations of other classes within the given class. !--> + <!-- See http://checkstyle.sf.net/config_metrics.html !--> + <!-- KIEKER Off --> + <!-- <module name="ClassDataAbstractionCoupling"> + <property name="severity" value="info"/> + <property name="max" value="7"/> + </module> --> + + <!-- The number of other classes a given class relies on. !--> + <!-- See http://checkstyle.sf.net/config_metrics.html !--> + <!-- KIEKER Off --> + <!--<module name="ClassFanOutComplexity"> + <property name="severity" value="info"/> + <property name="max" value="20"/> + </module> --> + + <!-- Checks cyclomatic complexity against a specified limit. !--> + <!-- See http://checkstyle.sf.net/config_metrics.html !--> + <module name="CyclomaticComplexity"> + <property name="severity" value="ignore"/> + <property name="max" value="10"/> + </module> + + <!-- Determines complexity of methods, classes and files by counting the Non Commenting Source Statements (NCSS). !--> + <!-- See http://checkstyle.sourceforge.net/config_metrics.html#JavaNCSS !--> + <!-- KIEKER Off --> + <!--<module name="JavaNCSS"> + <property name="severity" value="info"/> + <property name="methodMaximum" value="50"/> + <property name="classMaximum" value="1500"/> + <property name="fileMaximum" value="2000"/> + </module> --> + + <!-- The NPATH metric computes the number of possible execution paths through a function. !--> + <!-- See http://checkstyle.sf.net/config_metrics.html !--> + <!-- KIEKER Off --> + <!--<module name="NPathComplexity"> + <property name="severity" value="info"/> + <property name="max" value="200"/> + </module> --> + + + <!-- + !________________________________________________________________________________________ + ! + ! M I S C E L L A N E O U S + !________________________________________________________________________________________ + !--> + <!-- Checks the style of array type definitions. !--> + <!-- See http://checkstyle.sf.net/config_misc.html !--> + <module name="ArrayTypeStyle"> + <property name="javaStyle" value="true"/> + </module> + + <!-- Checks for restricted tokens beneath other tokens. !--> + <!-- See http://checkstyle.sf.net/config_misc.html !--> + <!-- Default: OFF + <module name="DescendantToken"> + <property name="tokens" value=""/> + <property name="limitedTokens" value=""/> + <property name="minimumDepth" value="0"/> + <property name="maximumDepth" value="java.lang.Integer.MAX_VALUE"/> + <property name="minimumNumber" value="0"/> + <property name="maximumNumber" value="java.lang.Integer.MAX_VALUE"/> + <property name="sumTokenCounts" value="false"/> + <property name="minimumMessage" value="descendant.token.min"/> + <property name="maximumMessage" value="descendant.token.max"/> + </module> + !--> + + <!-- Check that method/constructor parameters are final. !--> + <!-- See http://checkstyle.sf.net/config_misc.html !--> + <module name="FinalParameters"> + <property name="tokens" value="METHOD_DEF, CTOR_DEF"/> + </module> + + <!-- A generic check for code problems - the user can search for any pattern. !--> + <!-- See http://checkstyle.sf.net/config_misc.html !--> + <!-- Default: OFF + <module name="GenericIllegalRegexp"> + <property name="format" value="\S\s+$"/> + <property name="message" value="Line has trailing spaces."/> + <property name="ignoreCase" value="false"/> + <property name="ignoreComments" value="false"/> + </module> + !--> + + <!-- Checks correct indentation of Java Code. !--> + <!-- See http://checkstyle.sf.net/config_misc.html !--> + <!-- KIEKER deactivated for now + <module name="Indentation"> + <property name="severity" value="info"/> + <property name="basicOffset" value="4"/> + <property name="braceAdjustment" value="0"/> + <property name="caseIndent" value="0"/> + </module> + !--> + + <!-- Checks that the outer type name and the file name match. !--> + <!-- See http://checkstyle.sourceforge.net/config_misc.html#OuterTypeFilename !--> + <module name="OuterTypeFilename"/> + + <!-- A check for TODO: comments. Actually it is a generic regular expression matcher on Java comments. !--> + <!-- See http://checkstyle.sf.net/config_misc.html !--> + <!-- Kieker !--> + <module name="TodoComment"> + <property name="format" value="TODO"/> + <property name="severity" value="warning"/> + </module> + <module name="TodoComment"> + <property name="format" value="FIXME"/> + <property name="severity" value="error"/> + </module> + + <!-- The check to ensure that requires that comments be the only thing on a line. !--> + <!-- See http://checkstyle.sf.net/config_misc.html !--> + <!-- KIEKER we use them + <module name="TrailingComment"> + <property name="format" value="^[\\s\\}\\);]*$"/> + <property name="legalComment" value=""/> + </module> + --> + + <!-- Checks for uncommented main() methods (debugging leftovers). !--> + <!-- See http://checkstyle.sf.net/config_misc.html !--> + <!-- KIEKER do not check for these + <module name="UncommentedMain"> + <property name="severity" value="info"/> + <property name="excludedClasses" value="Main$"/> + </module> + --> + + <!-- Checks that long constants are defined with an upper ell. That is 'L' and not 'l'. !--> + <!-- See http://checkstyle.sf.net/config_misc.html !--> + <module name="UpperEll"/> + + + <!-- + !________________________________________________________________________________________ + ! + ! M O D I F I E R S + !________________________________________________________________________________________ + !--> + <!-- Checks that the order of modifiers conforms to the suggestions in the Java Language specification, !--> + <!-- sections 8.1.1, 8.3.1 and 8.4.3. !--> + <!-- See http://checkstyle.sf.net/config_modifiers.html !--> + <module name="ModifierOrder"/> + + <!-- Checks that there are no redundant modifiers. !--> + <!-- See http://checkstyle.sf.net/config_modifiers.html !--> + <!-- KIEKER off + <module name="RedundantModifier"> + <property name="tokens" value="METHOD_DEF, VARIABLE_DEF, ANNOTATION_FIELD_DEF"/> + </module> + !--> + + <!-- + !________________________________________________________________________________________ + ! + ! N A M I N G C O N V E N T I O N S + !________________________________________________________________________________________ + !--> + <!-- Checks for abstract class name naming conventions. !--> + <!-- See http://checkstyle.sf.net/config_naming.html !--> + <!-- KIEKER removed |^.*Factory$ --> + <module name="AbstractClassName"> + <property name="format" value="^Abstract.*$"/> + <property name="ignoreModifier" value="false"/> + <property name="ignoreName" value="false"/> + </module> + + <!-- Checks for class type parameter name naming conventions. !--> + <!-- See http://checkstyle.sourceforge.net/config_naming.html#ClassTypeParameterName !--> + <module name="ClassTypeParameterName"> + <property name="format" value="^[A-Z]$"/> + </module> + + <!-- Checks for constant name naming conventions. !--> + <!-- See http://checkstyle.sf.net/config_naming.html !--> + <module name="ConstantName"> + <property name="format" value="^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"/> + <property name="applyToPublic" value="true"/> + <property name="applyToProtected" value="true"/> + <property name="applyToPackage" value="true"/> + <property name="applyToPrivate" value="true"/> + </module> + + <!-- Checks for local final variable name naming conventions. !--> + <!-- See http://checkstyle.sf.net/config_naming.html !--> + <module name="LocalFinalVariableName"> + <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> + <property name="tokens" value="VARIABLE_DEF, PARAMETER_DEF"/> + </module> + + <!-- Checks for local variable name naming conventions. !--> + <!-- See http://checkstyle.sf.net/config_naming.html !--> + <module name="LocalVariableName"> + <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> + <property name="tokens" value="PARAMETER_DEF"/> + </module> + + <!-- Checks for member variable name naming conventions. !--> + <!-- See http://checkstyle.sf.net/config_naming.html !--> + <module name="MemberName"> + <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> + <property name="applyToPublic" value="true"/> + <property name="applyToProtected" value="true"/> + <property name="applyToPackage" value="true"/> + <property name="applyToPrivate" value="true"/> + </module> + + <!-- Checks for method name naming conventions. !--> + <!-- See http://checkstyle.sf.net/config_naming.html !--> + <module name="MethodName"> + <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> + </module> + + <!-- Checks for method type parameter name naming conventions. !--> + <!-- See http://checkstyle.sourceforge.net/config_naming.html#MethodTypeParameterName !--> + <module name="MethodTypeParameterName"> + <property name="format" value="^[A-Z]$"/> + </module> + + <!-- Checks for package name naming conventions. !--> + <!-- See http://checkstyle.sf.net/config_naming.html !--> + <module name="PackageName"> + <property name="format" value="^[a-z]+(\.[a-zA-Z_][a-zA-Z0-9_]*)*$"/> + </module> + + <!-- Checks for parameter name naming conventions. !--> + <!-- See http://checkstyle.sf.net/config_naming.html !--> + <module name="ParameterName"> + <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> + </module> + + <!-- Checks for static variable name naming conventions. !--> + <!-- See http://checkstyle.sf.net/config_naming.html !--> + <module name="StaticVariableName"> + <property name="format" value="^[a-z][a-zA-Z0-9]*$"/> + <property name="applyToPublic" value="true"/> + <property name="applyToProtected" value="true"/> + <property name="applyToPackage" value="true"/> + <property name="applyToPrivate" value="true"/> + </module> + + <!-- Checks for type name naming conventions. !--> + <!-- See http://checkstyle.sf.net/config_naming.html !--> + <!-- KIEKER: modded --> + <module name="TypeName"> + <property name="format" value="^[A-Z][a-zA-Z0-9]*$"/> + <property name="tokens" value="CLASS_DEF"/> + <property name="applyToPublic" value="true"/> + <property name="applyToProtected" value="true"/> + <property name="applyToPackage" value="true"/> + <property name="applyToPrivate" value="true"/> + </module> + + <module name="TypeName"> + <property name="format" value="^I[A-Z][a-zA-Z0-9]*$"/> + <property name="tokens" value="INTERFACE_DEF"/> + <property name="applyToPublic" value="true"/> + <property name="applyToProtected" value="true"/> + <property name="applyToPackage" value="true"/> + <property name="applyToPrivate" value="true"/> + </module> + + + <!-- + !________________________________________________________________________________________ + ! + ! R E G E X P + !________________________________________________________________________________________ + !--> + <!-- A check that makes sure that a specified pattern exists, exists less than a set number of times, !--> + <!-- or does not exist in the file. !--> + <!-- See http://checkstyle.sourceforge.net/config_misc.html#Regexp !--> + <!-- Default: OFF + <module name="Regexp"> + <property name="format" value=""/> + <property name="message" value=""/> + <property name="illegalPattern" value="false"/> + <property name="duplicateLimit" value="-1"/> + <property name="errorLimit" value="100"/> + <property name="ignoreComments" value="false"/> + </module> + !--> + + <!-- This class is variation on RegexpSingleline for detecting single lines that match a !--> + <!-- supplied regular expression in Java files. It supports suppressing matches in Java comments. !--> + <!-- See http://checkstyle.sourceforge.net/config_regexp.html#RegexpSinglelineJava !--> + <!-- Default: OFF + <module name="RegexpSinglelineJava"> + <property name="format" value=""/> + <property name="message" value=""/> + <property name="ignoreCase" value="false"/> + <property name="minimum" value="0"/> + <property name="maximum" value="0"/> + <property name="ignoreComments" value="false"/> + </module> + !--> + + <!-- + !________________________________________________________________________________________ + ! + ! S I Z E V I O L A T I O N S + !________________________________________________________________________________________ + !--> + <!-- Checks for long anonymous inner classes. !--> + <!-- See http://checkstyle.sf.net/config_sizes.html !--> + <!-- KIEKER Set to 50 instead of 20 --> + <module name="AnonInnerLength"> + <property name="severity" value="info"/> + <property name="max" value="50"/> + </module> + + <!-- Restricts the number of executable statements to a specified limit. !--> + <!-- See http://checkstyle.sf.net/config_sizes.html !--> + <!-- KIEKER off + <module name="ExecutableStatementCount"> + <property name="severity" value="info"/> + <property name="max" value="30"/> + <property name="tokens" value="CTOR_DEF, METHOD_DEF, INSTANCE_INIT, STATIC_INIT"/> + </module> + !--> + + <!-- See http://checkstyle.sf.net/config_sizes.html !--> + <!-- Checks for long lines. !--> + <module name="LineLength"> + <property name="severity" value="info"/> + <property name="ignorePattern" value="^$"/> + <property name="max" value="165"/> + </module> + + <!-- Checks the number of methods declared in each type. This includes the number of each scope !--> + <!-- (private, package, protected and public) as well as an overall total. !--> + <!-- See http://checkstyle.sourceforge.net/config_sizes.html#MethodCount !--> + <module name="MethodCount"> + <property name="severity" value="info"/> + <property name="maxTotal" value="100"/> + <property name="maxPrivate" value="100"/> + <property name="maxPackage" value="100"/> + <property name="maxProtected" value="100"/> + <property name="maxPublic" value="100"/> + </module> + + <!-- Checks for long methods and constructors. !--> + <!-- See http://checkstyle.sf.net/config_sizes.html !--> + <module name="MethodLength"> + <property name="severity" value="info"/> + <property name="max" value="150"/> + <property name="countEmpty" value="true"/> + <property name="tokens" value="METHOD_DEF, CTOR_DEF"/> + </module> + + <!-- Checks for the number of types declared at the outer (or root) level in a file. !--> + <!-- See http://checkstyle.sourceforge.net/config_sizes.html#OuterTypeNumber !--> + <!-- KIEKER 2 !--> + <module name="OuterTypeNumber"> + <property name="max" value="2"/> + </module> + + <!-- Checks the number of parameters of a method or constructor. !--> + <!-- See http://checkstyle.sf.net/config_sizes.html !--> + <!-- KIEKER off + <module name="ParameterNumber"> + <property name="severity" value="info"/> + <property name="max" value="7"/> + <property name="tokens" value="METHOD_DEF, CTOR_DEF"/> + </module> + !--> + + <!-- + !________________________________________________________________________________________ + ! + ! W H I T E S P A C E + !________________________________________________________________________________________ + !--> + <!-- Checks the padding of an empty for initializer. !--> + <!-- See http://checkstyle.sf.net/config_whitespace.html !--> + <module name="EmptyForInitializerPad"> + <property name="option" value="nospace"/> + </module> + + <!-- Checks the padding of an empty for iterator. !--> + <!-- See http://checkstyle.sf.net/config_whitespace.html !--> + <module name="EmptyForIteratorPad"> + <property name="option" value="nospace"/> + </module> + + <!-- Checks that the whitespace around the Generic tokens < and > is correct to the typical convention. !--> + <!-- See http://checkstyle.sourceforge.net/config_whitespace.html#GenericWhitespace !--> + <module name="GenericWhitespace"/> + + <!-- Checks the padding between the identifier of a method definition, !--> + <!-- constructor definition, method call, or constructor invocation; and the left parenthesis of the parameter list. !--> + <!-- See http://checkstyle.sf.net/config_whitespace.html !--> + <module name="MethodParamPad"> + <property name="allowLineBreaks" value="false"/> + <property name="option" value="nospace"/> + <property name="tokens" value="CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF, SUPER_CTOR_CALL "/> + </module> + + <!-- Checks that there is no whitespace after a token. !--> + <!-- See http://checkstyle.sf.net/config_whitespace.html !--> + <!-- KIEKER removed ARRAY_INIT !--> + <module name="NoWhitespaceAfter"> + <property name="allowLineBreaks" value="true"/> + <property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/> + </module> + + <!-- Checks that there is no whitespace before a token. !--> + <!-- See http://checkstyle.sf.net/config_whitespace.html !--> + <module name="NoWhitespaceBefore"> + <property name="allowLineBreaks" value="false"/> + <property name="tokens" value="SEMI, POST_DEC, POST_INC"/> + </module> + + <!-- Checks the policy on how to wrap lines on operators. !--> + <!-- See http://checkstyle.sf.net/config_whitespace.html !--> + <module name="OperatorWrap"> + <property name="option" value="nl"/> + <property name="tokens" value="BAND, BOR, BSR, BXOR, COLON, DIV, + EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, + LOR, LT, MINUS, MOD, NOT_EQUAL, + PLUS, QUESTION, SL, SR, STAR"/> + </module> + + <!-- Checks the policy on the padding of parentheses. !--> + <!-- See http://checkstyle.sf.net/config_whitespace.html !--> + <module name="ParenPad"> + <property name="option" value="nospace"/> + <property name="tokens" value="CTOR_CALL, LPAREN, METHOD_CALL, RPAREN, SUPER_CTOR_CALL"/> + </module> + + <!-- Checks the policy on the padding of parentheses for typecasts. !--> + <!-- See http://checkstyle.sf.net/config_whitespace.html !--> + <module name="TypecastParenPad"> + <property name="option" value="nospace"/> + <property name="tokens" value="TYPECAST, RPAREN"/> + </module> + + <!-- Checks that a token is followed by whitespace. !--> + <!-- See http://checkstyle.sf.net/config_whitespace.html !--> + <module name="WhitespaceAfter"> + <property name="tokens" value="COMMA, SEMI, TYPECAST"/> + </module> + + <!-- Checks that a token is surrounded by whitespace. !--> + <!-- See http://checkstyle.sf.net/config_whitespace.html !--> + <module name="WhitespaceAround"> + <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, + BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, + LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, + LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, + LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, + MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, + QUESTION, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN"/> + <property name="allowEmptyConstructors" value="true"/> + <property name="allowEmptyMethods" value="true"/> + </module> + + </module> + +</module> diff --git a/results/evaluation.xlsx b/results/evaluation.xlsx index 237636274d109ea88dcd32de85ac7fe9c492c45b..5a62baf8e4f79279c96fbbb50b562cb8f244eceb 100644 Binary files a/results/evaluation.xlsx and b/results/evaluation.xlsx differ diff --git a/src/main/java/teetime/examples/countWords/ConcurrentCountWordsAnalysis.java b/src/main/java/teetime/examples/countWords/ConcurrentCountWordsAnalysis.java index 4fa5036223f19f0de33dbe846523a500dd48ed5c..70243758a91e4d1633838bce728623033fc74efa 100644 --- a/src/main/java/teetime/examples/countWords/ConcurrentCountWordsAnalysis.java +++ b/src/main/java/teetime/examples/countWords/ConcurrentCountWordsAnalysis.java @@ -17,7 +17,6 @@ package teetime.examples.countWords; import java.io.File; -import java.util.Arrays; import java.util.LinkedList; import java.util.List; @@ -28,11 +27,13 @@ import teetime.framework.concurrent.StageTerminationPolicy; import teetime.framework.concurrent.WorkerThread; import teetime.framework.core.Analysis; import teetime.framework.core.IInputPort; +import teetime.framework.core.IInputPort.PortState; import teetime.framework.core.IOutputPort; import teetime.framework.core.IPipeline; import teetime.framework.core.ISink; import teetime.framework.core.ISource; import teetime.framework.core.IStage; +import teetime.framework.core.Pipeline; import teetime.framework.sequential.MethodCallPipe; import teetime.framework.sequential.QueuePipe; import teetime.stage.basic.RepeaterSource; @@ -51,7 +52,7 @@ public class ConcurrentCountWordsAnalysis extends Analysis { private static final String START_DIRECTORY_NAME = "."; private static final int SECONDS = 1000; - private static final int MAX_NUM_THREADS = 3; + private static final int MAX_NUM_THREADS = 2; // 1:2150, 2:1400, 3:~1400, 4:~1400 private WorkerThread[] ioThreads; private WorkerThread[] nonIoThreads; @@ -82,6 +83,7 @@ public class ConcurrentCountWordsAnalysis extends Analysis { int numThreads = Runtime.getRuntime().availableProcessors(); numThreads = Math.min(MAX_NUM_THREADS, numThreads); // only for testing purposes + System.out.println("Using " + numThreads + " Threads."); this.nonIoThreads = new WorkerThread[numThreads]; for (int i = 0; i < this.nonIoThreads.length; i++) { @@ -142,6 +144,9 @@ public class ConcurrentCountWordsAnalysis extends Analysis { distributor.setAccessesDeviceId(1); // add each stage to a stage list + final List<IStage> startStages = new LinkedList<IStage>(); + startStages.add(repeaterSource); + final List<IStage> stages = new LinkedList<IStage>(); stages.add(repeaterSource); stages.add(directoryName2Files); @@ -152,34 +157,11 @@ public class ConcurrentCountWordsAnalysis extends Analysis { QueuePipe.connect(directoryName2Files.fileOutputPort, distributor.genericInputPort); repeaterSource.START.setAssociatedPipe(new MethodCallPipe<Boolean>(Boolean.TRUE)); + repeaterSource.START.setState(PortState.CLOSED); - final IPipeline pipeline = new IPipeline() { - @Override - @SuppressWarnings("unchecked") - public List<? extends IStage> getStartStages() { - return Arrays.asList(repeaterSource); - } - - @Override - public List<IStage> getStages() { - return stages; - } - - @Override - public void fireStartNotification() throws Exception { - for (final IStage stage : this.getStartStages()) { - stage.notifyPipelineStarts(); - } - } - - @Override - public void fireStopNotification() { - for (final IStage stage : this.getStartStages()) { - stage.notifyPipelineStops(); - } - } - }; - + final Pipeline pipeline = new Pipeline(); + pipeline.setStartStages(startStages); + pipeline.setStages(stages); return pipeline; } @@ -191,6 +173,9 @@ public class ConcurrentCountWordsAnalysis extends Analysis { final Merger<Pair<File, Integer>> merger = new Merger<Pair<File, Integer>>(); // add each stage to a stage list + final List<IStage> startStages = new LinkedList<IStage>(); + startStages.add(distributor); + final List<IStage> stages = new LinkedList<IStage>(); stages.add(distributor); stages.add(countWordsStage0); @@ -207,33 +192,9 @@ public class ConcurrentCountWordsAnalysis extends Analysis { SingleProducerSingleConsumerPipe.connect(merger.outputPort, printingMerger.getNewInputPort()); - final IPipeline pipeline = new IPipeline() { - @Override - @SuppressWarnings("unchecked") - public List<? extends IStage> getStartStages() { - return Arrays.asList(distributor); - } - - @Override - public List<IStage> getStages() { - return stages; - } - - @Override - public void fireStartNotification() throws Exception { - for (final IStage stage : this.getStartStages()) { - stage.notifyPipelineStarts(); - } - } - - @Override - public void fireStopNotification() { - for (final IStage stage : this.getStartStages()) { - stage.notifyPipelineStops(); - } - } - }; - + final Pipeline pipeline = new Pipeline(); + pipeline.setStartStages(startStages); + pipeline.setStages(stages); return pipeline; } @@ -245,6 +206,9 @@ public class ConcurrentCountWordsAnalysis extends Analysis { outputWordsCountStage.setAccessesDeviceId(2); // add each stage to a stage list + final List<IStage> startStages = new LinkedList<IStage>(); + startStages.add(merger); + final List<IStage> stages = new LinkedList<IStage>(); stages.add(merger); stages.add(outputWordsCountStage); @@ -252,33 +216,9 @@ public class ConcurrentCountWordsAnalysis extends Analysis { // connect stages by pipes QueuePipe.connect(merger.outputPort, outputWordsCountStage.fileWordcountTupleInputPort); - final IPipeline pipeline = new IPipeline() { - @Override - @SuppressWarnings("unchecked") - public List<? extends IStage> getStartStages() { - return Arrays.asList(merger); - } - - @Override - public List<IStage> getStages() { - return stages; - } - - @Override - public void fireStartNotification() throws Exception { - for (final IStage stage : this.getStartStages()) { - stage.notifyPipelineStarts(); - } - } - - @Override - public void fireStopNotification() { - for (final IStage stage : this.getStartStages()) { - stage.notifyPipelineStops(); - } - } - }; - + final Pipeline pipeline = new Pipeline(); + pipeline.setStartStages(startStages); + pipeline.setStages(stages); return pipeline; } @@ -327,8 +267,8 @@ public class ConcurrentCountWordsAnalysis extends Analysis { System.out.println(stage); // NOPMD (Just for example purposes) } -// final long durationInNs = thread.getDurationInNs(); -// System.out.println(thread + " takes " + TimeUnit.NANOSECONDS.toMillis(durationInNs) + " ms"); + // final long durationInNs = thread.getDurationInNs(); + // System.out.println(thread + " takes " + TimeUnit.NANOSECONDS.toMillis(durationInNs) + " ms"); } for (final WorkerThread thread : this.nonIoThreads) { @@ -337,16 +277,16 @@ public class ConcurrentCountWordsAnalysis extends Analysis { System.out.println(stage); // NOPMD (Just for example purposes) } -// final long durationInNs = thread.getDurationInNs(); -// System.out.println(thread + " takes " + TimeUnit.NANOSECONDS.toMillis(durationInNs) + " ms"); + // final long durationInNs = thread.getDurationInNs(); + // System.out.println(thread + " takes " + TimeUnit.NANOSECONDS.toMillis(durationInNs) + " ms"); -// if (durationInNs > maxDuration) { -// maxDuration = durationInNs; -// maxThread = thread; -// } + // if (durationInNs > maxDuration) { + // maxDuration = durationInNs; + // maxThread = thread; + // } } -// System.out.println("maxThread: " + maxThread.toString() + " takes " + TimeUnit.NANOSECONDS.toMillis(maxDuration) + " ms"); // NOPMD (Just for example - // purposes) + // System.out.println("maxThread: " + maxThread.toString() + " takes " + TimeUnit.NANOSECONDS.toMillis(maxDuration) + " ms"); // NOPMD (Just for example + // purposes) } } diff --git a/src/main/java/teetime/examples/countWords/CountWordsAnalysis.java b/src/main/java/teetime/examples/countWords/CountWordsAnalysis.java index c958a6e467c872254d51f6e414238dbfccf74458..1760d8addd25bc1090f8d11526680b9f1a8bd125 100644 --- a/src/main/java/teetime/examples/countWords/CountWordsAnalysis.java +++ b/src/main/java/teetime/examples/countWords/CountWordsAnalysis.java @@ -17,14 +17,15 @@ package teetime.examples.countWords; import java.io.File; -import java.util.Arrays; import java.util.LinkedList; import java.util.List; import teetime.framework.core.AbstractFilter; import teetime.framework.core.Analysis; +import teetime.framework.core.IInputPort.PortState; import teetime.framework.core.IPipeline; import teetime.framework.core.IStage; +import teetime.framework.core.Pipeline; import teetime.framework.sequential.MethodCallPipe; import teetime.stage.basic.RepeaterSource; import teetime.stage.basic.distributor.Distributor; @@ -79,6 +80,9 @@ public class CountWordsAnalysis extends Analysis { final OutputWordsCountSink outputWordsCountStage = new OutputWordsCountSink(); // add each stage to a stage list + final List<IStage> startStages = new LinkedList<IStage>(); + startStages.add(repeaterSource); + final List<IStage> stages = new LinkedList<IStage>(); stages.add(repeaterSource); stages.add(findFilesStage); @@ -98,34 +102,11 @@ public class CountWordsAnalysis extends Analysis { MethodCallPipe.connect(merger.outputPort, outputWordsCountStage.fileWordcountTupleInputPort); repeaterSource.START.setAssociatedPipe(new MethodCallPipe<Boolean>(Boolean.TRUE)); + repeaterSource.START.setState(PortState.CLOSED); - final IPipeline pipeline = new IPipeline() { - @Override - @SuppressWarnings("unchecked") - public List<? extends AbstractFilter<?>> getStartStages() { - return Arrays.asList(repeaterSource); - } - - @Override - public List<IStage> getStages() { - return stages; - } - - @Override - public void fireStartNotification() throws Exception { - for (final IStage stage : this.getStartStages()) { - stage.notifyPipelineStarts(); - } - } - - @Override - public void fireStopNotification() { - for (final IStage stage : this.getStartStages()) { - stage.notifyPipelineStops(); - } - } - }; - + final Pipeline pipeline = new Pipeline(); + pipeline.setStartStages(startStages); + pipeline.setStages(stages); return pipeline; } diff --git a/src/main/java/teetime/examples/countWords/QueuedCountWordsAnalysis.java b/src/main/java/teetime/examples/countWords/QueuedCountWordsAnalysis.java index 3047df1cfb64c67bff3795dd2c264db56c834ed9..afb82bbca69e854d6a2738cbfc6938ba733d16cd 100644 --- a/src/main/java/teetime/examples/countWords/QueuedCountWordsAnalysis.java +++ b/src/main/java/teetime/examples/countWords/QueuedCountWordsAnalysis.java @@ -17,7 +17,6 @@ package teetime.examples.countWords; import java.io.File; -import java.util.Arrays; import java.util.LinkedList; import java.util.List; @@ -25,8 +24,10 @@ import teetime.framework.concurrent.StageTerminationPolicy; import teetime.framework.concurrent.WorkerThread; import teetime.framework.core.AbstractFilter; import teetime.framework.core.Analysis; +import teetime.framework.core.IInputPort.PortState; import teetime.framework.core.IPipeline; import teetime.framework.core.IStage; +import teetime.framework.core.Pipeline; import teetime.framework.sequential.MethodCallPipe; import teetime.framework.sequential.QueuePipe; import teetime.stage.basic.RepeaterSource; @@ -81,6 +82,9 @@ public class QueuedCountWordsAnalysis extends Analysis { final OutputWordsCountSink outputWordsCountStage = new OutputWordsCountSink(); // add each stage to a stage list + final List<IStage> startStages = new LinkedList<IStage>(); + startStages.add(repeaterSource); + final List<IStage> stages = new LinkedList<IStage>(); stages.add(repeaterSource); stages.add(findFilesStage); @@ -100,34 +104,11 @@ public class QueuedCountWordsAnalysis extends Analysis { QueuePipe.connect(merger.outputPort, outputWordsCountStage.fileWordcountTupleInputPort); repeaterSource.START.setAssociatedPipe(new MethodCallPipe<Boolean>(Boolean.TRUE)); + repeaterSource.START.setState(PortState.CLOSED); - final IPipeline pipeline = new IPipeline() { - @Override - @SuppressWarnings("unchecked") - public List<? extends IStage> getStartStages() { - return Arrays.asList(repeaterSource); - } - - @Override - public List<IStage> getStages() { - return stages; - } - - @Override - public void fireStartNotification() throws Exception { - for (final IStage stage : this.getStartStages()) { - stage.notifyPipelineStarts(); - } - } - - @Override - public void fireStopNotification() { - for (final IStage stage : this.getStartStages()) { - stage.notifyPipelineStops(); - } - } - }; - + final Pipeline pipeline = new Pipeline(); + pipeline.setStartStages(startStages); + pipeline.setStages(stages); return pipeline; } diff --git a/src/main/java/teetime/framework/concurrent/StageWorkArrayList.java b/src/main/java/teetime/framework/concurrent/StageWorkArrayList.java index 9f70d0b70313d41ed288b0bf1ec5ee2866e09f1e..6f9f2c3ff007a2de9f5c8a9a614475dcb912615a 100644 --- a/src/main/java/teetime/framework/concurrent/StageWorkArrayList.java +++ b/src/main/java/teetime/framework/concurrent/StageWorkArrayList.java @@ -15,21 +15,15 @@ ***************************************************************************/ package teetime.framework.concurrent; -import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; import teetime.framework.core.IOutputPort; -import teetime.framework.core.IPipe; -import teetime.framework.core.IPipeCommand; import teetime.framework.core.IPipeline; import teetime.framework.core.IStage; /** * @author Christian Wulf - * + * * @since 1.10 */ public class StageWorkArrayList implements IStageWorkList { @@ -41,7 +35,6 @@ public class StageWorkArrayList implements IStageWorkList { public int numToBeExecuted; } - private final IPipeline pipeline; private final int accessesDeviceId; /** sorted array where the last stage has highest priority */ @@ -53,75 +46,25 @@ public class StageWorkArrayList implements IStageWorkList { * @since 1.10 */ public StageWorkArrayList(final IPipeline pipeline, final int accessesDeviceId) { - this.pipeline = pipeline; this.accessesDeviceId = accessesDeviceId; - final List<IStage> localStages = this.init(); - this.stages = new SchedulableStage[localStages.size()]; - for (int i = 0; i < localStages.size(); i++) { + this.stages = new SchedulableStage[pipeline.getStages().size()]; + for (IStage stage : pipeline.getStages()) { final SchedulableStage schedulableStage = new SchedulableStage(); - schedulableStage.stage = localStages.get(i); + schedulableStage.stage = stage; schedulableStage.numToBeExecuted = 0; - this.stages[i] = schedulableStage; - } - } - - private List<IStage> init() { - this.setDepthForEachStage(); - - final List<IStage> stageList = new ArrayList<IStage>(this.pipeline.getStages()); - final Comparator<? super IStage> depthComparator = new Comparator<IStage>() { - public int compare(final IStage o1, final IStage o2) { - if (o1.getDepth() == o2.getDepth()) { - return 0; - } else if (o1.getDepth() < o2.getDepth()) { - return -1; - } else { - return 1; - } - } - }; - - Collections.sort(stageList, depthComparator); - - for (int i = 0; i < stageList.size(); i++) { - stageList.get(i).setSchedulingIndex(i); - } - - return stageList; - } - - private void setDepthForEachStage() { - final IPipeCommand setDepthCommand = new IPipeCommand() { - public void execute(final IPipe<?> pipe) throws Exception { - final IStage sourceStage = pipe.getSourcePort().getOwningStage(); - final IStage owningStage = pipe.getTargetPort().getOwningStage(); - if (owningStage.getDepth() == IStage.DEPTH_NOT_SET) { - owningStage.setDepth(sourceStage.getDepth() + 1); - owningStage.notifyOutputPipes(this); - } - } - }; - - for (final IStage startStage : this.pipeline.getStartStages()) { - startStage.setDepth(0); - } - - for (final IStage startStage : this.pipeline.getStartStages()) { - try { - startStage.notifyOutputPipes(setDepthCommand); - } catch (final Exception e) { - throw new IllegalStateException("may not happen", e); - } + this.stages[stage.getSchedulingIndex()] = schedulableStage; } } + @Override public void pushAll(final Collection<? extends IStage> stages) { for (final IStage stage : stages) { this.push(stage); } } + @Override public void pushAll(final IOutputPort<?, ?>[] outputPorts) { for (final IOutputPort<?, ?> outputPort : outputPorts) { if (outputPort != null) { @@ -148,12 +91,12 @@ public class StageWorkArrayList implements IStageWorkList { return isValid; } + @Override public IStage pop() { final SchedulableStage schedulableStage = this.stages[this.lastIndex]; // schedulableStage.numToBeExecuted--; schedulableStage.numToBeExecuted = 0; - cond: - if (schedulableStage.numToBeExecuted == 0) + cond: if (schedulableStage.numToBeExecuted == 0) { for (int i = this.lastIndex - 1; i >= this.firstIndex; i--) { if (this.stages[i].numToBeExecuted > 0) { @@ -167,11 +110,13 @@ public class StageWorkArrayList implements IStageWorkList { return schedulableStage.stage; } + @Override public IStage read() { final SchedulableStage schedulableStage = this.stages[this.lastIndex]; return schedulableStage.stage; } + @Override public boolean isEmpty() { return this.lastIndex == -1; } diff --git a/src/main/java/teetime/framework/concurrent/WorkerThread.java b/src/main/java/teetime/framework/concurrent/WorkerThread.java index ca1e5e77d0dbc35b7806b0017f36060cc2076880..d1dff2d15e7999121d6d72d3d0ac21f183b89d8b 100644 --- a/src/main/java/teetime/framework/concurrent/WorkerThread.java +++ b/src/main/java/teetime/framework/concurrent/WorkerThread.java @@ -16,11 +16,20 @@ package teetime.framework.concurrent; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.LinkedList; import java.util.List; +import teetime.framework.core.IInputPort; +import teetime.framework.core.IInputPort.PortState; +import teetime.framework.core.IPipe; +import teetime.framework.core.IPipeCommand; import teetime.framework.core.IPipeline; import teetime.framework.core.IStage; +import teetime.framework.scheduling.NextStageScheduler; +import teetime.framework.scheduling.StageStateManager; import teetime.util.StopWatch; /** @@ -30,8 +39,11 @@ import teetime.util.StopWatch; */ public class WorkerThread extends Thread { + private static final int NUM_ITERATIONS_TO_MEASURE = 10000; + private final IPipeline pipeline; private IStageScheduler stageScheduler; + private StageStateManager stageStateManager; private volatile StageTerminationPolicy terminationPolicy; private volatile boolean shouldTerminate = false; @@ -40,15 +52,72 @@ public class WorkerThread extends Thread { // statistics private final StopWatch stopWatch = new StopWatch(); - private final List<Long> durationPer10000IterationsInNs = new LinkedList<Long>(); + private final List<Long> durationPerXIterationsInNs = new LinkedList<Long>(); private int iterations; public WorkerThread(final IPipeline pipeline, final int accessesDeviceId) { this.pipeline = pipeline; + this.accessesDeviceId = accessesDeviceId; + } + + private void initStages(final IPipeline pipeline) { for (final IStage stage : pipeline.getStages()) { stage.setOwningThread(this); } - this.accessesDeviceId = accessesDeviceId; + + this.setDepthForEachStage(pipeline); + this.setSchedulingIndexForEachhStage(pipeline); + } + + private void setDepthForEachStage(final IPipeline pipeline) { + final IPipeCommand setDepthCommand = new IPipeCommand() { + @Override + public void execute(final IPipe<?> pipe) throws Exception { + final IStage sourceStage = pipe.getSourcePort().getOwningStage(); + final IStage owningStage = pipe.getTargetPort().getOwningStage(); + if (owningStage.getDepth() == IStage.DEPTH_NOT_SET) { + owningStage.setDepth(sourceStage.getDepth() + 1); + owningStage.notifyOutputPipes(this); + } + } + }; + + for (final IStage startStage : pipeline.getStartStages()) { + startStage.setDepth(0); + } + + for (final IStage startStage : pipeline.getStartStages()) { + try { + startStage.notifyOutputPipes(setDepthCommand); + } catch (final Exception e) { + throw new IllegalStateException("may not happen", e); + } + } + } + + private List<IStage> setSchedulingIndexForEachhStage(final IPipeline pipeline) { + final List<IStage> stageList = new ArrayList<IStage>(pipeline.getStages()); + + final Comparator<? super IStage> depthComparator = new Comparator<IStage>() { + @Override + public int compare(final IStage o1, final IStage o2) { + if (o1.getDepth() == o2.getDepth()) { + return 0; + } else if (o1.getDepth() < o2.getDepth()) { + return -1; + } else { + return 1; + } + } + }; + + Collections.sort(stageList, depthComparator); + + for (int i = 0; i < stageList.size(); i++) { + stageList.get(i).setSchedulingIndex(i); + } + + return stageList; } @Override @@ -94,38 +163,37 @@ public class WorkerThread extends Thread { // stageExecutionStopWatch.getDurationInNs(); //4952 // 6268 -> 5350 (w/o after) -> 4450 (w/o before) -> 3800 (w/o stage) -// final long schedulingOverhead = this.iterationStopWatch.getDurationInNs(); + // final long schedulingOverhead = this.iterationStopWatch.getDurationInNs(); // final long schedulingOverhead = beforeStageExecutionStopWatch.getDurationInNs(); //327 // final long schedulingOverhead = stageExecutionStopWatch.getDurationInNs(); //1416 // final long schedulingOverhead = afterStageExecutionStopWatch.getDurationInNs(); //2450 // rest: ~2000 (measurement overhead?) - if ((iterations % 10000) == 0) { + if ((this.iterations % NUM_ITERATIONS_TO_MEASURE) == 0) { this.stopWatch.end(); - this.durationPer10000IterationsInNs.add(stopWatch.getDurationInNs()); + this.durationPerXIterationsInNs.add(this.stopWatch.getDurationInNs()); this.stopWatch.start(); } } this.stopWatch.end(); - this.durationPer10000IterationsInNs.add(stopWatch.getDurationInNs()); + this.durationPerXIterationsInNs.add(this.stopWatch.getDurationInNs()); this.cleanUpDatastructures(); } private void executeTerminationPolicy(final IStage executedStage, final boolean executedSuccessfully) { - // System.out.println("WorkerThread.executeTerminationPolicy(): " + this.terminationPolicy + - // ", executedSuccessfully=" + executedSuccessfully - // + ", mayBeDisabled=" + executedStage.mayBeDisabled()); +// System.out.println("executeTerminationPolicy executedStage=" + executedStage + ", executedSuccessfully=" + executedSuccessfully); +// System.out.println("executeTerminationPolicy areAllInputPortsClosed(executedStage)=" + this.stageStateManager.areAllInputPortsClosed(executedStage)); switch (this.terminationPolicy) { case TERMINATE_STAGE_AFTER_NEXT_EXECUTION: - if (executedStage.mayBeDisabled()) { + if (this.stageStateManager.areAllInputPortsClosed(executedStage)) { this.stageScheduler.disable(executedStage); } break; case TERMINATE_STAGE_AFTER_UNSUCCESSFUL_EXECUTION: if (!executedSuccessfully) { - if (executedStage.mayBeDisabled()) { + if (this.stageStateManager.areAllInputPortsClosed(executedStage)) { this.stageScheduler.disable(executedStage); } } @@ -141,8 +209,20 @@ public class WorkerThread extends Thread { } private void initDatastructures() throws Exception { + // stages need to be initialized here, because in a concurrent context some stages (e.g., a merger) is executed after its pipeline has been created. + this.initStages(this.pipeline); + this.stageStateManager = new StageStateManager(this.pipeline); + this.stageScheduler = new NextStageScheduler(this.pipeline, this.accessesDeviceId, this.stageStateManager); + + for (final IStage startStage : this.pipeline.getStartStages()) { + for (IInputPort<IStage, ?> inputPort : startStage.getInputPorts()) { + if (inputPort.getState() == PortState.CLOSED) { + inputPort.close(); + } + } + } + this.pipeline.fireStartNotification(); - this.stageScheduler = new NextStageScheduler(this.pipeline, this.accessesDeviceId); } private void startStageExecution(final IStage stage) { @@ -150,18 +230,13 @@ public class WorkerThread extends Thread { } private void finishStageExecution(final IStage stage, final boolean executedSuccessfully) { - // System.out.println("Executed stage " + stage + " successfully: " + executedSuccessfully); if (!executedSuccessfully) { // statistics this.executedUnsuccessfullyCount++; } } private void cleanUpDatastructures() { - // System.out.println("Cleaning up datastructures..."); - // System.out.println("Firing stop notification..."); this.pipeline.fireStopNotification(); - // System.out.println("Thread terminated:" + this); - // System.out.println(this.getName() + ": executedUnsuccessfullyCount=" + this.executedUnsuccessfullyCount); } public IPipeline getPipeline() { @@ -171,9 +246,11 @@ public class WorkerThread extends Thread { // BETTER remove this method since it is not intuitive; add a check to onStartPipeline so that a stage automatically // disables itself if it has no input ports public void terminate(final StageTerminationPolicy terminationPolicyToUse) { - for (final IStage startStage : this.pipeline.getStartStages()) { - startStage.fireSignalClosingToAllInputPorts(); - } +// for (final IStage startStage : this.pipeline.getStartStages()) { +// if (this.stageStateManager.areAllInputPortsClosed(startStage)) { +// startStage.fireSignalClosingToAllInputPorts(); +// } +// } this.setTerminationPolicy(terminationPolicyToUse); } @@ -193,14 +270,14 @@ public class WorkerThread extends Thread { } public List<Long> getDurationPer10000IterationsInNs() { - return durationPer10000IterationsInNs; + return this.durationPerXIterationsInNs; } /** * @since 1.10 */ public int getIterations() { - return iterations; + return this.iterations; } } diff --git a/src/main/java/teetime/framework/concurrent/steal/StealIfMayBeDisabledStrategy.java b/src/main/java/teetime/framework/concurrent/steal/StealIfMayBeDisabledStrategy.java deleted file mode 100644 index f153f60b35635306ac097cefd7c7c9cc6c24438d..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/framework/concurrent/steal/StealIfMayBeDisabledStrategy.java +++ /dev/null @@ -1,44 +0,0 @@ -/*************************************************************************** - * Copyright 2014 Kieker Project (http://kieker-monitoring.net) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - ***************************************************************************/ -package teetime.framework.concurrent.steal; - -import java.util.Collection; - -import teetime.framework.concurrent.ConcurrentWorkStealingPipe; -import teetime.framework.core.IInputPort; -import teetime.framework.core.IStage; - -/** - * @author Christian Wulf - * - * @since 1.10 - */ -public class StealIfMayBeDisabledStrategy<T> implements IStealStrategy<T> { - - public <S extends IStage> T steal(final IInputPort<S, T> inputPort, final Collection<ConcurrentWorkStealingPipe<T>> pipesToStealFrom) { - if (inputPort.getOwningStage().mayBeDisabled()) { - for (final ConcurrentWorkStealingPipe<T> pipe : pipesToStealFrom) { - final T stolenElement = pipe.steal(); - if (stolenElement != null) { - return stolenElement; - } - } - } - // BETTER improve stealing efficiency by stealing multiple elements at once - return null; // do not expose internal impl details (here: CircularWorkStealingDeque); instead return null - } - -} diff --git a/src/main/java/teetime/framework/core/AbstractFilter.java b/src/main/java/teetime/framework/core/AbstractFilter.java index 16b7cabb94383b09e2ea493352f70d7d40330841..6222eabbcd05905fa9d0e97798f04263ec3fdfe9 100644 --- a/src/main/java/teetime/framework/core/AbstractFilter.java +++ b/src/main/java/teetime/framework/core/AbstractFilter.java @@ -34,9 +34,7 @@ import teetime.util.concurrent.workstealing.exception.DequePopException; * the extending stage * */ -public abstract class AbstractFilter<S extends IStage> extends AbstractStage implements ISink<S>, ISource, IPortListener<S> { - - protected volatile boolean mayBeDisabled; // BETTER write only non-concurrent code in a stage +public abstract class AbstractFilter<S extends IStage> extends AbstractStage implements ISink<S>, ISource { /** * @author Christian Wulf @@ -78,7 +76,6 @@ public abstract class AbstractFilter<S extends IStage> extends AbstractStage imp } }; - private int enabledInputPorts = 0; /** * 0=in-memory, x>0=disk0, disk1, display0, display1, socket0, socket1 etc. */ @@ -172,48 +169,6 @@ public abstract class AbstractFilter<S extends IStage> extends AbstractStage imp // default empty implementation } - /** - * @since 1.10 - */ - @Override - public void onPortIsClosed(final IInputPort<S, ?> inputPort) { - // inputPort.setState(IInputPort.State.CLOSING); - this.enabledInputPorts--; // FIXME not thread-safe - // this.logger.info("Closed " + "(" + this.enabledInputPorts + " remaining) " + inputPort + " of " + this); - - if (this.enabledInputPorts < 0) { - this.logger.error("Closed port more than once: portIndex=" + inputPort.getIndex() + " for stage " + this); - } - - this.checkWhetherThisStageMayBeDisabled(); - } - - /** - * @since 1.10 - */ - private void checkWhetherThisStageMayBeDisabled() { - if (this.enabledInputPorts == 0) { - this.mayBeDisabled = true; - // this.logger.info(this.toString() + " can now be disabled by the pipeline scheduler."); - } - } - - /** - * @since 1.10 - */ - @Override - public void fireSignalClosingToAllInputPorts() { - // this.logger.info("Fire closing signal to all input ports of: " + this); - - if (!this.inputPorts.isEmpty()) { - for (final IInputPort<S, ?> port : this.inputPorts) { - port.close(); - } - } else { - this.checkWhetherThisStageMayBeDisabled(); - } - } - /** * @since 1.10 */ @@ -222,18 +177,10 @@ public abstract class AbstractFilter<S extends IStage> extends AbstractStage imp try { this.notifyOutputPipes(this.closeCommand); } catch (final Exception e) { - throw new IllegalStateException("may not happen"); + throw new IllegalStateException("may not happen", e); } } - /** - * @since 1.10 - */ - @Override - public boolean mayBeDisabled() { - return this.mayBeDisabled; - } - @Override public String toString() { final String s = super.toString(); @@ -250,8 +197,6 @@ public abstract class AbstractFilter<S extends IStage> extends AbstractStage imp final InputPortImpl<S, T> inputPort = new InputPortImpl<S, T>((S) this); inputPort.setIndex(this.inputPorts.size()); this.inputPorts.add(inputPort); - inputPort.setPortListener(this); - this.enabledInputPorts++; return inputPort; } diff --git a/src/main/java/teetime/framework/core/AbstractPipe.java b/src/main/java/teetime/framework/core/AbstractPipe.java index 1e596bf51687feab00ee3fbce47f92375c5223f1..14ed5f78ffe90bcec92781d9e461cb1f64ba6879 100644 --- a/src/main/java/teetime/framework/core/AbstractPipe.java +++ b/src/main/java/teetime/framework/core/AbstractPipe.java @@ -18,9 +18,9 @@ package teetime.framework.core; /** * @author Christian Wulf - * + * * @since 1.10 - * + * * @param <T> * The type of the pipe * @param <P> @@ -30,7 +30,7 @@ public abstract class AbstractPipe<T> implements IPipe<T> { /** * @author Christian Wulf - * + * * @since 1.10 */ public enum PipeState { @@ -42,19 +42,23 @@ public abstract class AbstractPipe<T> implements IPipe<T> { private IOutputPort<?, ? extends T> sourcePort; private IInputPort<?, T> targetPort; + @Override public IOutputPort<?, ? extends T> getSourcePort() { return this.sourcePort; } + @Override public IInputPort<?, T> getTargetPort() { return this.targetPort; } + @Override public <S extends ISource, A extends T> void setSourcePort(final IOutputPort<S, A> sourcePort) { sourcePort.setAssociatedPipe(this); this.sourcePort = sourcePort; } + @Override public <S extends ISink<S>, A extends T> void setTargetPort(final IInputPort<S, T> targetPort) { targetPort.setAssociatedPipe(this); this.targetPort = targetPort; @@ -63,6 +67,7 @@ public abstract class AbstractPipe<T> implements IPipe<T> { // BETTER remove if it does not add any new functionality protected abstract void putInternal(T token); + @Override public void put(final T token) { this.putInternal(token); } @@ -70,10 +75,12 @@ public abstract class AbstractPipe<T> implements IPipe<T> { // BETTER remove if it does not add any new functionality protected abstract T tryTakeInternal(); + @Override public final T tryTake() { return this.tryTakeInternal(); } + @Override public final void notifyPipelineStarts() throws Exception { if (this.state == PipeState.UNINITIALIZED) { this.state = PipeState.PIPELINE_STARTED; @@ -84,13 +91,14 @@ public abstract class AbstractPipe<T> implements IPipe<T> { /** * This method is called exactly once iff the pipeline is started. - * + * * @since 1.10 */ public void onPipelineStarts() { // empty default implementation } + @Override public final void notifyPipelineStops() { if (this.state != PipeState.PIPELINE_STOPPED) { this.state = PipeState.PIPELINE_STOPPED; @@ -101,13 +109,14 @@ public abstract class AbstractPipe<T> implements IPipe<T> { /** * This method is called exactly once iff the pipeline is stopped. - * + * * @since 1.10 */ public void onPipelineStops() { // empty default implementation } + @Override public void close() { this.targetPort.close(); } diff --git a/src/main/java/teetime/framework/core/IInputPort.java b/src/main/java/teetime/framework/core/IInputPort.java index 3d834da75d345bef241d217d2c466bfed2358c4f..d463e0749562c2d216c0b1083cad34e1a1e2d407 100644 --- a/src/main/java/teetime/framework/core/IInputPort.java +++ b/src/main/java/teetime/framework/core/IInputPort.java @@ -1,9 +1,9 @@ package teetime.framework.core; /** - * + * * @author Christian Wulf - * + * * @param <S> * the stage, this port belongs to<br> * <i>(used for ensuring type safety)</i> @@ -14,24 +14,24 @@ public interface IInputPort<S extends IStage, T> extends IPort<S, T> { /** * @since 1.10 */ - enum State { - OPEN, CLOSING + public enum PortState { + OPENED, CLOSED } /** * @since 1.10 */ - public abstract State getState(); + public abstract PortState getState(); /** * @since 1.10 */ - public abstract void setState(final State state); + public abstract void setState(final PortState state); /** * @since 1.10 */ - public abstract void setPortListener(final IPortListener<S> stageListener); + public abstract void setPortListener(final IPortListener portListener); /** * @since 1.10 diff --git a/src/main/java/teetime/framework/core/IPortListener.java b/src/main/java/teetime/framework/core/IPortListener.java index 71b05c98f541155bc393bbebbc8dd8458b0120fa..b7783c325a70f551f07dc8246497790ebcfc1030 100644 --- a/src/main/java/teetime/framework/core/IPortListener.java +++ b/src/main/java/teetime/framework/core/IPortListener.java @@ -17,10 +17,10 @@ package teetime.framework.core; /** * @author Christian Wulf - * + * * @since 1.10 */ -public interface IPortListener<S extends IStage> { +public interface IPortListener { - void onPortIsClosed(IInputPort<S, ?> inputPort); + void onPortIsClosed(IInputPort<?, ?> inputPort); } diff --git a/src/main/java/teetime/framework/core/IStage.java b/src/main/java/teetime/framework/core/IStage.java index 19c68d9d3ef068cc0211f5ab8353e4372c28b8c7..bda94d98df5f7ef1fd0e7726b4de368fcd08f4c7 100644 --- a/src/main/java/teetime/framework/core/IStage.java +++ b/src/main/java/teetime/framework/core/IStage.java @@ -69,24 +69,11 @@ public interface IStage extends IBaseStage { // an overloaded version with a task bundle of one single input port is useless. // void execute(TaskBundle taskBundle); - /** - * - * @return <code>true</code> if the stage may be disabled by the pipeline scheduler, <code>false</code> otherwise. - * - * @since 1.10 - */ - boolean mayBeDisabled(); - /** * @since 1.10 */ void fireSignalClosingToAllOutputPorts(); - /** - * @since 1.10 - */ - void fireSignalClosingToAllInputPorts(); - /** * @since 1.10 */ diff --git a/src/main/java/teetime/framework/core/InputPortImpl.java b/src/main/java/teetime/framework/core/InputPortImpl.java index fb9c6c2ef9f55351a75b7ceecb18aa423e6efe3c..021ab567ba56b8f25553a21ac288b0f8583d27f6 100644 --- a/src/main/java/teetime/framework/core/InputPortImpl.java +++ b/src/main/java/teetime/framework/core/InputPortImpl.java @@ -18,28 +18,35 @@ package teetime.framework.core; class InputPortImpl<S extends IStage, T> extends AbstractPort<S, T> implements IInputPort<S, T> { - private volatile State state = State.OPEN; + private volatile PortState state = PortState.OPENED; - private IPortListener<S> stageListener; + private IPortListener portListener; public InputPortImpl(final S owningStage) { this.setOwningStage(owningStage); } - public void setState(final State state) { + @Override + public void setState(final PortState state) { this.state = state; } - public State getState() { + @Override + public PortState getState() { return this.state; } - public void setPortListener(final IPortListener<S> stageListener) { - this.stageListener = stageListener; + @Override + public void setPortListener(final IPortListener portListener) { + this.portListener = portListener; } + @Override public void close() { - this.stageListener.onPortIsClosed(this); + if (this.portListener == null) { + throw new NullPointerException("stage: "+this.getOwningStage().getClass().getName()+", port="+this.getIndex()); + } + this.portListener.onPortIsClosed(this); } } diff --git a/src/main/java/teetime/framework/concurrent/NextStageScheduler.java b/src/main/java/teetime/framework/scheduling/NextStageScheduler.java similarity index 76% rename from src/main/java/teetime/framework/concurrent/NextStageScheduler.java rename to src/main/java/teetime/framework/scheduling/NextStageScheduler.java index 82263b5b569a1057e730cabd07bbb8e37f0b5962..ef7fa67f1dc4ece57f103e1941da644d52eccdf5 100644 --- a/src/main/java/teetime/framework/concurrent/NextStageScheduler.java +++ b/src/main/java/teetime/framework/scheduling/NextStageScheduler.java @@ -14,13 +14,14 @@ * limitations under the License. ***************************************************************************/ -package teetime.framework.concurrent; +package teetime.framework.scheduling; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; +import java.util.LinkedHashSet; +import java.util.Set; +import teetime.framework.concurrent.IStageScheduler; +import teetime.framework.concurrent.IStageWorkList; +import teetime.framework.concurrent.StageWorkArrayList; import teetime.framework.core.IOutputPort; import teetime.framework.core.IPipeline; import teetime.framework.core.IStage; @@ -30,13 +31,14 @@ import teetime.framework.core.IStage; * * @since 1.10 */ -public class NextStageScheduler implements IStageScheduler { +public final class NextStageScheduler implements IStageScheduler { - protected final Map<IStage, Boolean> statesOfStages = new HashMap<IStage, Boolean>(); - private final Collection<IStage> highestPrioritizedEnabledStages = new ArrayList<IStage>(); + private final Set<IStage> highestPrioritizedEnabledStages = new LinkedHashSet<IStage>(); private final IStageWorkList workList; + private final StageStateManager stageStateManager; - public NextStageScheduler(final IPipeline pipeline, final int accessesDeviceId) throws Exception { + public NextStageScheduler(final IPipeline pipeline, final int accessesDeviceId, final StageStateManager stageStateManager) { + this.stageStateManager = stageStateManager; // this.workList = new StageWorkList(accessesDeviceId, pipeline.getStages().size()); this.workList = new StageWorkArrayList(pipeline, accessesDeviceId); // faster implementation @@ -45,10 +47,6 @@ public class NextStageScheduler implements IStageScheduler { this.workList.pushAll(this.highestPrioritizedEnabledStages); // System.out.println("Initial work list: " + this.workList); // this.workList.addAll(pipeline.getStages()); - - for (final IStage stage : pipeline.getStages()) { - this.enable(stage); - } } @Override @@ -58,28 +56,23 @@ public class NextStageScheduler implements IStageScheduler { @Override public boolean isAnyStageActive() { - // System.out.println("workList: " + this.workList); return !this.workList.isEmpty(); } - protected void enable(final IStage stage) { - // // / TODO consider to move state (enabled/disabled) of stage to stage for performance reasons - this.statesOfStages.put(stage, Boolean.TRUE); - } - @Override public void disable(final IStage stage) { - this.statesOfStages.put(stage, Boolean.FALSE); + this.stageStateManager.disable(stage); if (this.highestPrioritizedEnabledStages.contains(stage)) { this.highestPrioritizedEnabledStages.remove(stage); for (final IStage outputStage : stage.getAllOutputStages()) { - if (this.statesOfStages.get(outputStage) == Boolean.TRUE) { + if (this.stageStateManager.isStageEnabled(outputStage)) { this.highestPrioritizedEnabledStages.add(outputStage); } } } +// System.out.println("highestPrioritizedEnabledStages: "+this.highestPrioritizedEnabledStages); stage.fireSignalClosingToAllOutputPorts(); } diff --git a/src/main/java/teetime/framework/scheduling/StageStateContainer.java b/src/main/java/teetime/framework/scheduling/StageStateContainer.java new file mode 100644 index 0000000000000000000000000000000000000000..667d639d9c3ba6b0c2862751f4c9cdb1fd56e7d9 --- /dev/null +++ b/src/main/java/teetime/framework/scheduling/StageStateContainer.java @@ -0,0 +1,25 @@ +package teetime.framework.scheduling; + +import teetime.framework.core.IStage; + +public abstract class StageStateContainer { + + public static enum StageState { + ENABLED, ALL_INPUT_PORTS_CLOSED, DISABLED + } + + protected final IStage stage; + protected volatile StageState stageState; + + public StageStateContainer(final IStage stage) { + this.stage = stage; + this.stageState = stage.getInputPorts().size() > 0 ? StageState.ENABLED : StageState.ALL_INPUT_PORTS_CLOSED; +// System.out.println("stage=" + stage + ", stageState=" + this.stageState); + } + + /** + * + * @return the new value + */ + public abstract int decNumOpenedPorts(); +} diff --git a/src/main/java/teetime/framework/scheduling/StageStateManager.java b/src/main/java/teetime/framework/scheduling/StageStateManager.java new file mode 100644 index 0000000000000000000000000000000000000000..6412ae9bb04c0201a826859bb81a13ec0b82d37f --- /dev/null +++ b/src/main/java/teetime/framework/scheduling/StageStateManager.java @@ -0,0 +1,84 @@ +package teetime.framework.scheduling; + +import java.util.Arrays; + +import teetime.framework.core.IInputPort; +import teetime.framework.core.IPipeline; +import teetime.framework.core.IPortListener; +import teetime.framework.core.IStage; +import teetime.framework.scheduling.StageStateContainer.StageState; + +public final class StageStateManager implements IPortListener { + + private final StageStateContainer[] stageStateContainers; + + public StageStateManager(final IPipeline pipeline) { + this.stageStateContainers = this.initStageStateContainers(pipeline); + this.registerAtAllInputPorts(pipeline); + } + + private void registerAtAllInputPorts(final IPipeline pipeline) { + for (IStage stage : pipeline.getStages()) { + for (IInputPort<IStage, ?> inputPort : stage.getInputPorts()) { + inputPort.setPortListener(this); + } + } + } + + private StageStateContainer[] initStageStateContainers(final IPipeline pipeline) { + StageStateContainer[] stageStateContainers = new StageStateContainer[pipeline.getStages().size()]; + for (IStage stage : pipeline.getStages()) { + StageStateContainer stageStateContainer; + if (this.isConnectedWithAnotherThread(stage)) { + stageStateContainer = new SynchronizedStageStateContainer(stage); + } else { + stageStateContainer = new UnsynchronizedStageStateContainer(stage); + } + stageStateContainers[stage.getSchedulingIndex()] = stageStateContainer; + } + return stageStateContainers; + } + + private boolean isConnectedWithAnotherThread(final IStage stage) { + // TODO Auto-generated method stub + return true; + } + + @Override + public void onPortIsClosed(final IInputPort<?, ?> inputPort) { + StageStateContainer stageStateContainer = this.getStageStateContainer(inputPort.getOwningStage()); + + int newNumOpenedPorts = stageStateContainer.decNumOpenedPorts(); + if (newNumOpenedPorts == 0) { + stageStateContainer.stageState = StageState.ALL_INPUT_PORTS_CLOSED; +// System.out.println("Closed stage: " + stageStateContainer.stage); + } else if (newNumOpenedPorts < 0) { + // TODO log warning + // this.logger.warning("Closed port more than once: portIndex=" + inputPort.getIndex() + " for stage " + this); + } + } + + public boolean areAllInputPortsClosed(final IStage stage) { + StageStateContainer stageStateContainer = this.getStageStateContainer(stage); + return stageStateContainer.stageState == StageState.ALL_INPUT_PORTS_CLOSED; + } + + public boolean isStageEnabled(final IStage stage) { + StageStateContainer stageStateContainer = this.getStageStateContainer(stage); + return stageStateContainer.stageState == StageState.ENABLED; + } + + public void disable(final IStage stage) { + StageStateContainer stageStateContainer = this.getStageStateContainer(stage); + stageStateContainer.stageState = StageState.DISABLED; + } + + private StageStateContainer getStageStateContainer(final IStage stage) { + int schedulingIndex = stage.getSchedulingIndex(); + StageStateContainer stageStateContainer = this.stageStateContainers[schedulingIndex]; + if (stageStateContainer == null) { + throw new NullPointerException("No container found for index ="+schedulingIndex+"\n=> stageStateContainers="+Arrays.asList(this.stageStateContainers)); + } + return stageStateContainer; + } +} diff --git a/src/main/java/teetime/framework/scheduling/SynchronizedStageStateContainer.java b/src/main/java/teetime/framework/scheduling/SynchronizedStageStateContainer.java new file mode 100644 index 0000000000000000000000000000000000000000..9b70846a2dcf535d5e554d6c1cafa8e23b301b13 --- /dev/null +++ b/src/main/java/teetime/framework/scheduling/SynchronizedStageStateContainer.java @@ -0,0 +1,21 @@ +package teetime.framework.scheduling; + +import java.util.concurrent.atomic.AtomicInteger; + +import teetime.framework.core.IStage; + +public final class SynchronizedStageStateContainer extends StageStateContainer { + + private final AtomicInteger numOpenedPorts = new AtomicInteger(); + + public SynchronizedStageStateContainer(final IStage stage) { + super(stage); + this.numOpenedPorts.set(stage.getInputPorts().size()); + } + + @Override + public int decNumOpenedPorts() { + return this.numOpenedPorts.decrementAndGet(); + } + +} diff --git a/src/main/java/teetime/framework/scheduling/UnsynchronizedStageStateContainer.java b/src/main/java/teetime/framework/scheduling/UnsynchronizedStageStateContainer.java new file mode 100644 index 0000000000000000000000000000000000000000..46556e99deee76345c389915bd4ecf9367ae7c6a --- /dev/null +++ b/src/main/java/teetime/framework/scheduling/UnsynchronizedStageStateContainer.java @@ -0,0 +1,19 @@ +package teetime.framework.scheduling; + +import teetime.framework.core.IStage; + +public final class UnsynchronizedStageStateContainer extends StageStateContainer { + + private int numOpenedInputPorts; + + public UnsynchronizedStageStateContainer(final IStage stage) { + super(stage); + this.numOpenedInputPorts = stage.getInputPorts().size(); + } + + @Override + public int decNumOpenedPorts() { + return --this.numOpenedInputPorts; + } + +} diff --git a/src/test/java/teetime/examples/throughput/ThroughputTimestampAnalysisTest.java b/src/test/java/teetime/examples/throughput/ThroughputTimestampAnalysisTest.java index a122c8ec94850bb614f9ed6ac7c8fc314341057c..be0e8e866c0c1b574e478bfadfe0679cf54317ce 100644 --- a/src/test/java/teetime/examples/throughput/ThroughputTimestampAnalysisTest.java +++ b/src/test/java/teetime/examples/throughput/ThroughputTimestampAnalysisTest.java @@ -19,14 +19,14 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; -import kieker.common.logging.LogFactory; - import org.junit.Before; import org.junit.Test; import teetime.util.StatisticsUtil; import teetime.util.StopWatch; +import kieker.common.logging.LogFactory; + /** * @author Christian Wulf *