객체의 참조 비교: == 연산자는 객체의 메모리 주소를 비교합니다. 즉, 두 객체가 동일한 객체를 참조하는 경우에만 true를 반환합니다. 객체의 내용이 동일하더라도 서로 다른 메모리 주소를 가리키면 false를 반환합니다.

 

1. 정수(Integer)

  • 기본형 정수: Java의 기본형 정수 타입(int, long 등)은 스택 메모리에 저장됩니다. 메서드가 호출될 때마다 스택 프레임에 할당되며, 메서드가 종료되면 해당 스택 프레임이 제거되면서 메모리도 해제됩니다.
  • 래퍼 클래스: Integer와 같은 래퍼 클래스는 객체이기 때문에 힙 메모리에 저장됩니다. 래퍼 클래스의 경우, -128부터 127까지의 값은 캐싱되어 스트링 풀과 유사한 방식으로 재사용됩니다. 이 범위를 초과하는 값은 새로운 객체가 생성되므로, 각기 다른 메모리 주소를 가지게 됩니다.
Integer a = 127;
Integer b = 127;
System.out.println(a == b); // true: a와 b는 동일한 객체를 참조함

 

  • 범위를 벗어난 경우: -128 미만 또는 128 이상의 정수 리터럴은 새로운 객체를 생성하므로 서로 다른 객체를 참조합니다.
Integer c = 128;
Integer d = 128;
System.out.println(c == d); // false: c와 d는 서로 다른 객체를 참조함

 

 

 

 

2. 문자열(String)

  • 문자열 리터럴: 문자열 리터럴은 JVM의 스트링 풀이라는 특별한 메모리 영역에 저장됩니다. 같은 문자열 리터럴은 항상 같은 객체를 참조합니다. 즉, 문자열 리터럴은 캐싱되며, 새로운 문자열 리터럴이 생성될 경우 기존의 문자열과 동일한 내용이라면 스트링 풀에서 기존 객체를 참조하게 됩니다.
String str1 = "Hello";
String str2 = "Hello";

System.out.println(str1 == str2); // true (같은 객체를 참조)

 

 

  • new 키워드를 사용한 문자열: new String("Hello")와 같이 문자열 객체를 생성하면, 항상 새로운 객체가 힙 메모리에 저장됩니다. 이 경우에는 스트링 풀의 캐싱을 사용하지 않으므로, 같은 내용을 가진 문자열이라도 서로 다른 메모리 주소를 가집니다.
String str3 = new String("Hello");
String str4 = new String("Hello");
System.out.println(str3 == str4); // false: str3과 str4는 서로 다른 객체를 참조함

 

 

결론

  • 정수: -128부터 127까지는 같은 객체, 그 외의 정수는 다른 객체.
  • 문자열: 같은 문자열 리터럴은 항상 같은 객체, new 키워드를 사용하면 항상 새로운 객체.

'Java' 카테고리의 다른 글

함수형 인터페이스  (0) 2024.11.25
JVM 메모리 구조  (0) 2024.11.02
기본형 VS 참조형  (1) 2024.10.31
@SQLDelete  (0) 2024.09.09
epuals()와 hashCode() 오버라이딩  (0) 2024.03.07

'CS' 카테고리의 다른 글

스레드  (0) 2024.11.18
프로세스  (0) 2024.11.17
컴퓨터의 네 가지 핵심 부품  (0) 2024.10.30

 

3. Remote Team Meeting

 

Mr.Tom: Is everyone able to hear me clearly on the video call?

 

Ms.Mary: Yes, your audio and video are coming through perfectly.

 

Mr.Tom: Let's begin with updates from each department.

 

Ms.Mary: I'll start with the marketing team's progress on the Q2 campaign.

* Q2 : the second quarter 2분기 4,5,6월

 

Mr.Tom: Have we resolved the technical issues from last week?

 

Ms.Mary: Yes, IT has implemented a new VPN solution that's working smoothly.

 

Mr.Tom: What's the status of the international expansion project?

 

Ms.Mary: We've completed market research for three target countries.

 

Mr.Tom: How are we handling the time zone differences?

 

Ms.Mary: We've established overlapping work hours and implemented asynchronous communication tools.

* establish : 설정하다

* 근무지별 시차를 고려해 중복 근무 시간을 만들어서 서로 근무 시간이 겹치는 동안에는 직접 소통할 수 있도록 하고, 겹치지 않는 시간대에는 메신저나 이메일 같은 비동기 소통 도구로 필요한 정보를 주고받는 방식입니다. 이를 통해 시차가 있는 팀원들 간에도 효율적인 협업이 가능해지는 것입니다.

 

Mr.Tom: Can everyone access the new project management software?

 

Ms.Mary: Most team members have completed the onboarding, but three still need training.

 

Mr.Tom: What challenges are you facing with remote collaboration?

 

Ms.Mary: Document version control has been our biggest hurdle.

 

Mr.Tom: Should we invest in additional collaboration tools?

 

Ms.Mary: Yes, I recommend we explore some advanced file-sharing solutions

 

 

 

 

+) establish VS implement

  1. Establish:
    • : '설립하다', '확립하다', '정하다'라는 의미로, 새로운 시스템, 규칙, 또는 관계를 만드는 것에 중점을 둡니다.
    • 예시: "We established a new policy." (우리는 새로운 정책을 정했다.)
    • 이 경우에는 정책이 만들어졌다는 사실에 초점이 맞춰져 있습니다.
  2. Implement:
    • : '실행하다', '이행하다'라는 의미로, 이미 정해진 계획이나 정책을 실제로 시행하는 것에 중점을 둡니다.
    • 예시: "We implemented the new policy." (우리는 새로운 정책을 실행했다.)
    • 이 경우에는 정책이 실제로 적용되었다는 과정에 초점이 맞춰져 있습니다.

차이점 요약:

  • Establish는 무엇인가를 정하고 세우는 과정에 중점을 두고,
  • Implement는 그것을 실제로 실행하는 과정에 중점을 둡니다.

따라서, "established overlapping work hours"는 중복 근무 시간을 정했다는 것을 강조하고, "implemented asynchronous communication tools"는 비동기 소통 도구를 실제로 사용하기 시작했다는 것을 강조하는 것입니다.

'Business English' 카테고리의 다른 글

1. Implementing a New Customer Relationship Management (CRM) System  (1) 2024.11.06
5. Sales Strategy Meeting  (1) 2024.11.05
4. Performance Review  (0) 2024.11.02
2. Client Negotiation  (2) 2024.10.31
1. Project Status Meeting  (0) 2024.10.30

자바에서는 기본형(primitive type)과 참조형(reference type)을 선택할 때 다음 기준에 따라 구분하는 것이 좋습니다:

  1. 성능이 중요한 경우 기본형 사용:
    • 기본형(int, double, boolean 등)은 메모리 효율이 높고 처리 속도가 빠릅니다. 따라서 성능이 중요한 로직이나 대량의 데이터를 다루는 경우, 기본형을 사용하는 것이 좋습니다.
    • 예를 들어, 루프 내에서 반복적으로 사용하는 변수나, 수학 연산에 자주 사용하는 경우 기본형을 사용하여 성능을 최적화할 수 있습니다.
  2. 객체로서의 기능이 필요한 경우 참조형 사용:
    • 객체로 취급되어야 하거나, 컬렉션(List, Map, Set 등)에 저장해야 할 때는 참조형을 사용해야 합니다. 자바의 컬렉션은 기본형을 직접 저장할 수 없고, Integer, Double, Boolean 등의 참조형을 사용해야 합니다.
    • 예를 들어, List<Integer>를 사용할 때 int가 아닌 Integer로 박싱하여 사용해야 합니다.
  3. null이 필요한 경우 참조형 사용:
    • 기본형은 null을 가질 수 없기 때문에, null 값이 필요할 때는 참조형을 사용해야 합니다.
    • 예를 들어, 데이터베이스에서 값을 가져올 때, 값이 없음을 null로 표현할 경우, 기본형 대신 Integer, Double 같은 참조형을 사용합니다.

요약

  • 기본형: 성능이 중요한 경우, null이 필요 없을 때, 계산을 많이 하는 경우.
  • 참조형: 컬렉션에 저장할 때, null 값을 허용해야 할 때, 객체 기능이 필요할 때.

'Java' 카테고리의 다른 글

함수형 인터페이스  (0) 2024.11.25
JVM 메모리 구조  (0) 2024.11.02
참조형 변수 캐싱  (0) 2024.11.01
@SQLDelete  (0) 2024.09.09
epuals()와 hashCode() 오버라이딩  (0) 2024.03.07

 

 

2. Client Negotiation


Mr.Tom: Thank you for meeting with us today to discuss the contract terms.

 

Ms.Mary: We appreciate the opportunity to review the agreement in detail.

 

Mr.Tom: Our primary concern is the proposed payment schedule.

 

Ms.Mary: We're open to adjusting it to better align with your cash flow needs.

 

Mr.Tom: Could we extend the payment terms to net-60?

* net 30 (days)나 net 60 (days)라는 표현은 청구서를 받은 날로부터 시작해서 30일 후 지급 혹은 60일 후 지급처럼 돈이 실제로 들어오기까지 걸리는 날짜를 의미합니다. 

 

Ms.Mary: While net-60 might be challenging, we could consider net-45 with a 2% early payment discount.

 

Mr.Tom: What guarantees can you provide regarding delivery timelines?

 

Ms.Mary: We include a service level agreement with specific performance metrics and penalties.

* SLA (서비스 수준 계약) : 공급업체가 고객에게 제공하기로 약속한 서비스 수준을 명시하는 아웃소싱 및 기술 공급업체 계약입니다. 이 계약에는 가동 시간, 납품 시간, 응답 시간 및 해결 시간 등의 지표가 포함되어 있습니다. 또한 SLA는 추가 지원 또는 가격 할인 등 요구 사항이 충족되지 않았을 경우의 조치가 설명되어 있습니다.

 

Mr.Tom: I see the pricing doesn't include maintenance support.

 

Ms.Mary: We can bundle in a 12-month maintenance package at a discounted rate.

 

Mr.Tom: Let's discuss the scope of that maintenance package.

* scope :  범위

 

Ms.Mary: It covers all updates, priority support, and quarterly system reviews.

 

Mr.Tom: What about training for our staff?

 

Ms.Mary: We'll provide comprehensive onsite training for up to 15 employees.

* onsite : 현장의

* up to ~ : 최대 ~까지

 

Mr.Tom: When can you send the revised proposal?

 

Ms.Mary: You'll have it on your desk first thing tomorrow morning.

 

'Business English' 카테고리의 다른 글

1. Implementing a New Customer Relationship Management (CRM) System  (1) 2024.11.06
5. Sales Strategy Meeting  (1) 2024.11.05
4. Performance Review  (0) 2024.11.02
3. Remote Team Meeting  (2) 2024.11.01
1. Project Status Meeting  (0) 2024.10.30

CPU 작동 과정

  1. 메모리에서 데이터와 명령어 불러오기:
    • CPU는 메모리(RAM)에서 명령어와 데이터를 가져옵니다. 이 과정은 보통 프로그램 카운터(PC)에 의해 관리되며, 현재 실행할 명령어의 주소를 가리킵니다.
    • CPU는 해당 주소에서 명령어를 읽어와 레지스터에 저장합니다.
  2. 제어장치(Control Unit) 해석:
    • 제어장치는 불러온 명령어를 해석하여 어떤 작업을 수행할지 결정합니다. 명령어는 연산을 수행할 ALU(산술 논리 장치)와 다른 장치들을 제어하는 신호를 생성합니다.
  3. ALU 연산 수행:
    • ALU는 레지스터에 저장된 데이터와 명령어를 기반으로 연산을 수행합니다. 예를 들어, 덧셈, 뺄셈, 논리 연산 등을 수행할 수 있습니다.
  4. 결과 저장:
    • 연산이 완료되면 결과는 다시 레지스터에 저장됩니다. 이렇게 저장된 결과는 이후에 다른 연산에 사용되거나, 최종적으로 메모리에 저장될 수 있습니다.
  5. 반복:
    • 이 과정은 프로그램이 종료될 때까지 반복됩니다. CPU는 다음 명령어를 가져오고, 해석하고, 연산하고, 결과를 저장하는 과정을 계속 진행합니다.

'CS' 카테고리의 다른 글

스레드  (0) 2024.11.18
프로세스  (0) 2024.11.17
코어와 스레드  (1) 2024.11.01

 

 

 

Mr.Tom: Could you walk me through the current status of the Wilson project?

 

Ms.Mary: Certainly. We're tracking slightly behind schedule, but we've implemented mitigation measures to catch up.

* mitigation : 완화

 

Mr.Tom: What specifically is causing the delay?

 

Ms.Mary: The main bottleneck has been the vendor's delayed delivery of key components.

 

Mr.Tom: Have you considered alternative suppliers?

 

Ms.Mary: Yes, I've already shortlisted three potential backup vendors as contingency.

* contingency : 예비책, 대비 방안

 

Mr.Tom: What's the impact on our budget?

 

Ms.Mary: We're still within our allocated budget, but there's only a 5% buffer remaining.

* buffer : 여유분, 완충제

 

Mr.Tom: Can you send me a detailed breakdown of the remaining costs?

* breakdown : 세부 항목, 명세서

 

Ms.Mary: I'll prepare a comprehensive cost analysis report by tomorrow morning.

* comprehensive : 종합적인

 

Mr.Tom: How about the client's reaction to these delays?

 

Ms.Mary: They're understandably concerned, but I've been maintaining transparent communication with them.

 

Mr.Tom: What's your proposed timeline for getting back on track?

 

Ms.Mary: I estimate we can make up the lost time within three weeks if we implement overtime.

 

Mr.Tom: Do we need to allocate additional resources?

 

Ms.Mary: Yes, I recommend bringing in two more team members temporarily.

 

Mr.Tom: Let's schedule a follow-up meeting next week to review progress.

 

Ms.Mary: I'll send out a calendar invitation for next Wednesday at 2 PM.

'Business English' 카테고리의 다른 글

1. Implementing a New Customer Relationship Management (CRM) System  (1) 2024.11.06
5. Sales Strategy Meeting  (1) 2024.11.05
4. Performance Review  (0) 2024.11.02
3. Remote Team Meeting  (2) 2024.11.01
2. Client Negotiation  (2) 2024.10.31

일반적으론 YAML 파일 대신 @Configuration 클래스로 설정하지만 학습하는 단계이므로 간단하게 설정

kafka:
  bootstrap-servers: localhost:9092  # 클러스터에 있는 브로커 서버 주소 (초기 연결용)
  consumer: 
    group-id: ${spring.application.name}-group  # 그룹 아이디 (@KafkaListener에 설정 권장)
    auto-offset-reset: earliest  # earliest: 처음부터 읽음, latest: 최근부터 읽음 (일반적으로 latest 사용)
    key-deserializer: org.apache.kafka.common.serialization.StringDeserializer  # 메시지 키 역직렬화
    value-deserializer: org.springframework.kafka.support.serializer.JsonDeserializer  # 메시지 값 역직렬화
    properties:
      spring.json.trusted.packages: '*'  # 역직렬화에 사용할 패키지 목록 (모든 패키지 허용)
  producer:
    key-serializer: org.apache.kafka.common.serialization.StringSerializer  # 메시지 키 직렬화
    value-serializer: org.springframework.kafka.support.serializer.JsonSerializer  # 메시지 값 직렬화

1. 부트스트랩 서버 (bootstrap-servers)

  • 설명: 클러스터에 있는 여러 브로커 중 하나 이상의 주소를 설정하여 클라이언트가 Kafka 클러스터에 처음 연결할 때 사용됩니다.
  • 역할: 클라이언트는 이 주소를 통해 다른 브로커들의 메타데이터를 얻고 클러스터와 통신을 시작합니다.

2. 컨슈머 그룹 아이디 (group-id)

  • 설명: 컨슈머 그룹을 식별하는 아이디로, 동일한 그룹에 속한 여러 컨슈머가 토픽의 메시지를 나누어 소비합니다.
  • 특징:
    • 그룹 아이디를 기반으로 오프셋을 추적하여 재시작 시 마지막 읽은 위치에서 이어서 메시지를 소비합니다.
    • 동일 그룹 내에서 메시지 중복 소비는 발생하지 않으며, 각 컨슈머는 다른 파티션의 메시지를 소비합니다.
  • 권장: @KafkaListener에서 groupId를 직접 설정하는 것이 일반적입니다.

3. auto-offset-reset

  • 설명: 새로운 컨슈머 그룹이 메시지를 처음 읽을 때, 이전 오프셋을 찾을 수 없는 경우 어떤 시점부터 메시지를 읽을지 설정합니다.
  • 옵션:
    • earliest: 가장 처음부터 메시지를 읽음
    • latest: 가장 최근 메시지부터 읽음 (기본적으로 많이 사용)
  • 용도: 특정 시점부터 메시지를 읽고 싶다면 earliest를 사용하고, 일반적인 경우에는 latest를 사용합니다.

4. 직렬화 및 역직렬화 (Serialization & Deserialization)

  • 설명: 메시지를 보내고 받을 때 데이터를 변환하는 설정입니다.
  • 옵션:
    • 컨슈머:
      • key-deserializer: 메시지의 키를 역직렬화
      • value-deserializer: 메시지의 값을 역직렬화
    • 프로듀서:
      • key-serializer: 메시지의 키를 직렬화
      • value-serializer: 메시지의 값을 직렬화

5. ack 설정

  • 설명: 프로듀서가 전송한 메시지에 대해 브로커로부터 받는 응답 방식입니다.
  • 옵션:
    • acks=0:
      • 특징: 프로듀서는 브로커로부터 응답을 기다리지 않음
      • 장점: 성능이 매우 높음
      • 단점: 메시지 손실 가능성이 높음
    • acks=1 (기본값):
      • 특징: 리더 브로커가 메시지를 받으면 프로듀서에게 응답을 보냄
      • 장점: 적당한 성능과 안정성의 균형
      • 단점: 리더 브로커가 메시지를 잃으면 데이터 손실 가능성
    • acks=all 또는 acks=-1:
      • 특징: 리더와 모든 팔로워 브로커에 메시지가 복제된 후 프로듀서에게 응답을 보냄
      • 장점: 데이터 손실 가능성이 거의 없음
      • 단점: 성능이 가장 낮음
    •  

 

 

 

참고)

'bootstrap 서버 주소'라고 부르는 이유는 클러스터와 연결하기 위한 초기 진입점(bootstrap point)으로서 사용되기 때문입니다. 클라이언트(컨슈머 또는 프로듀서)가 Kafka 클러스터에 처음 연결할 때, 클러스터 내 모든 브로커의 정보를 알 필요는 없습니다. 대신, 하나 또는 몇 개의 브로커 주소만 알면 나머지 브로커에 대한 정보를 자동으로 조회할 수 있게 됩니다.

 

 

Spring Kafka 설정을 Java @Configuration 파일로 변환한 예시

import org.apache.kafka.clients.admin.NewTopic;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.apache.kafka.common.serialization.StringSerializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.annotation.EnableKafka;
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
import org.springframework.kafka.core.*;

import java.util.HashMap;
import java.util.Map;

@EnableKafka
@Configuration
public class KafkaConfig {

    // Consumer 설정
    @Bean
    public ConsumerFactory<String, Object> consumerFactory() {
        Map<String, Object> props = new HashMap<>();
        props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092"); // bootstrap 서버 주소
        props.put(ConsumerConfig.GROUP_ID_CONFIG, "your-group-id"); // 컨슈머 그룹 아이디 설정
        props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); // auto-offset-reset 설정
        props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class); // 키 역직렬화
        props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, JsonDeserializer.class); // 값 역직렬화
        props.put("spring.json.trusted.packages", "*"); // 역직렬화 가능한 패키지

        return new DefaultKafkaConsumerFactory<>(props);
    }

    @Bean
    public ConcurrentKafkaListenerContainerFactory<String, Object> kafkaListenerContainerFactory() {
        ConcurrentKafkaListenerContainerFactory<String, Object> factory = 
            new ConcurrentKafkaListenerContainerFactory<>();
        factory.setConsumerFactory(consumerFactory());
        return factory;
    }

    // Producer 설정
    @Bean
    public ProducerFactory<String, Object> producerFactory() {
        Map<String, Object> props = new HashMap<>();
        props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092"); // bootstrap 서버 주소
        props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class); // 키 직렬화
        props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JsonSerializer.class); // 값 직렬화

        return new DefaultKafkaProducerFactory<>(props);
    }

    @Bean
    public KafkaTemplate<String, Object> kafkaTemplate() {
        return new KafkaTemplate<>(producerFactory());
    }

    // 추가로 토픽을 생성하는 설정 (필요 시 사용)
    @Bean
    public NewTopic topic1() {
        return new NewTopic("topic-name", 1, (short) 1);
    }
}

 

 

'Kafka' 카테고리의 다른 글

토픽  (0) 2024.08.14

+ Recent posts